#include "internal.h"
#include "threads.h"
#include "logging.h"
+#include "util.h"
#include "../qemud/event.h"
#define NUM_FDS 5
/* First time, is easy - just try triggering one of our
* registered handles */
startJob("Simple write", &test);
- ret = write(handles[1].pipeFD[1], &one, 1);
+ ret = safewrite(handles[1].pipeFD[1], &one, 1);
if (finishJob(1, -1) != EXIT_SUCCESS)
return EXIT_FAILURE;
* try triggering another handle */
virEventRemoveHandleImpl(handles[0].watch);
startJob("Deleted before poll", &test);
- ret = write(handles[1].pipeFD[1], &one, 1);
+ ret = safewrite(handles[1].pipeFD[1], &one, 1);
if (finishJob(1, -1) != EXIT_SUCCESS)
return EXIT_FAILURE;
/* NB: this case is subject to a bit of a race condition.
* Only 1 time in 3 does the 2nd write get triggered by
- * before poll() exits for the first write(). We don't
+ * before poll() exits for the first safewrite(). We don't
* see a hard failure in other cases, so nothing to worry
* about */
startJob("Deleted during dispatch", &test);
handles[2].delete = handles[3].watch;
- ret = write(handles[2].pipeFD[1], &one, 1);
- ret = write(handles[3].pipeFD[1], &one, 1);
+ ret = safewrite(handles[2].pipeFD[1], &one, 1);
+ ret = safewrite(handles[3].pipeFD[1], &one, 1);
if (finishJob(2, -1) != EXIT_SUCCESS)
return EXIT_FAILURE;
/* Extreme fun, lets delete ourselves during dispatch */
startJob("Deleted during dispatch", &test);
handles[2].delete = handles[2].watch;
- ret = write(handles[2].pipeFD[1], &one, 1);
+ ret = safewrite(handles[2].pipeFD[1], &one, 1);
if (finishJob(2, -1) != EXIT_SUCCESS)
return EXIT_FAILURE;
/* NB: this case is subject to a bit of a race condition.
* Only 1 time in 3 does the 2nd write get triggered by
- * before poll() exits for the first write(). We don't
+ * before poll() exits for the first safewrite(). We don't
* see a hard failure in other cases, so nothing to worry
* about */
virEventUpdateTimeoutImpl(timers[2].timer, 100);