mirror of https://github.com/BOINC/boinc.git
Check return value of write function
This patch closes the file descriptor and returns with a failure, when there is a failure.
This commit is contained in:
parent
93f4dde515
commit
adde78647b
|
@ -339,7 +339,10 @@ int create_shmem_mmap(const char *path, size_t size, void** pp) {
|
|||
// area to all zeros because they write beyond the old EOF.
|
||||
// See the lseek man page for details.
|
||||
lseek(fd, size-1, SEEK_SET);
|
||||
write(fd, "\0", 1);
|
||||
if (1 != write(fd, "\0", 1)) {
|
||||
close(fd);
|
||||
return ERR_SHMGET;
|
||||
}
|
||||
}
|
||||
|
||||
*pp = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_FILE | MAP_SHARED, fd, 0);
|
||||
|
|
Loading…
Reference in New Issue