diff --git a/coverager.c b/coverager.c index 3fc143a..f48d788 100644 --- a/coverager.c +++ b/coverager.c @@ -171,9 +171,13 @@ static void xc_coverager_save_cov(char *srcfile, char *outfilename, coverager_t p[0] = 0; p[1] = covlines; - ftruncate(fd, 0); + if (ftruncate(fd, 0) != 0) { + goto bailout; + } lseek(fd, 0, SEEK_SET); - write(fd, (char *) buf, size); + if (write(fd, (char *) buf, size) != size) { + goto bailout; + } bailout: if (contents) efree(contents); diff --git a/mmap.c b/mmap.c index b99f29b..a8d4af2 100644 --- a/mmap.c +++ b/mmap.c @@ -186,7 +186,12 @@ static XC_SHM_INIT(xc_mmap_init) /* {{{ */ goto err; } } - ftruncate(fd, size); + + if (ftruncate(fd, size) != 0) { + perror(shm->name); + errstr = "Failed to ftruncate the file"; + goto err; + } #endif #ifdef ZEND_WIN32 diff --git a/xcache.c b/xcache.c index 5abf724..afc4c17 100644 --- a/xcache.c +++ b/xcache.c @@ -3155,7 +3155,10 @@ static void xcache_signal_handler(int sig) /* {{{ */ { xcache_restore_signal_handler(); if (xc_coredump_dir && xc_coredump_dir[0]) { - chdir(xc_coredump_dir); + if (chdir(xc_coredump_dir) != 0) { + /* error, but nothing can do about it + * and should'nt print anything which might SEGV again */ + } } raise(sig); }