Revision dc330e28 vl.c
b/vl.c | ||
---|---|---|
3185 | 3185 |
static void qemu_event_increment(void) |
3186 | 3186 |
{ |
3187 | 3187 |
static const char byte = 0; |
3188 |
ssize_t ret; |
|
3188 | 3189 |
|
3189 | 3190 |
if (io_thread_fd == -1) |
3190 | 3191 |
return; |
3191 | 3192 |
|
3192 |
write(io_thread_fd, &byte, sizeof(byte)); |
|
3193 |
ret = write(io_thread_fd, &byte, sizeof(byte)); |
|
3194 |
if (ret < 0 && (errno != EINTR && errno != EAGAIN)) { |
|
3195 |
fprintf(stderr, "qemu_event_increment: write() filed: %s\n", |
|
3196 |
strerror(errno)); |
|
3197 |
exit (1); |
|
3198 |
} |
|
3193 | 3199 |
} |
3194 | 3200 |
|
3195 | 3201 |
static void qemu_event_read(void *opaque) |
... | ... | |
5647 | 5653 |
#ifndef _WIN32 |
5648 | 5654 |
if (daemonize) { |
5649 | 5655 |
uint8_t status = 1; |
5650 |
write(fds[1], &status, 1); |
|
5656 |
if (write(fds[1], &status, 1) != 1) { |
|
5657 |
perror("daemonize. Writing to pipe\n"); |
|
5658 |
} |
|
5651 | 5659 |
} else |
5652 | 5660 |
#endif |
5653 | 5661 |
fprintf(stderr, "Could not acquire pid file: %s\n", strerror(errno)); |
... | ... | |
5946 | 5954 |
if (len != 1) |
5947 | 5955 |
exit(1); |
5948 | 5956 |
|
5949 |
chdir("/"); |
|
5957 |
if (chdir("/")) { |
|
5958 |
perror("not able to chdir to /"); |
|
5959 |
exit(1); |
|
5960 |
} |
|
5950 | 5961 |
TFR(fd = qemu_open("/dev/null", O_RDWR)); |
5951 | 5962 |
if (fd == -1) |
5952 | 5963 |
exit(1); |
... | ... | |
5965 | 5976 |
fprintf(stderr, "chroot failed\n"); |
5966 | 5977 |
exit(1); |
5967 | 5978 |
} |
5968 |
chdir("/"); |
|
5979 |
if (chdir("/")) { |
|
5980 |
perror("not able to chdir to /"); |
|
5981 |
exit(1); |
|
5982 |
} |
|
5969 | 5983 |
} |
5970 | 5984 |
|
5971 | 5985 |
if (run_as) { |
Also available in: Unified diff