mirror of
https://github.com/tezc/sc.git
synced 2025-01-14 06:43:04 +08:00
sc_mmap : cleanup fd on failure for Mac OS
This commit is contained in:
parent
9863c861ff
commit
90146f93be
@ -216,12 +216,12 @@ int sc_mmap_init(struct sc_mmap *m, const char *name, int file_flags, int prot,
|
||||
|
||||
ssize_t seek = lseek(fd, pos, SEEK_SET);
|
||||
if (seek == -1) {
|
||||
return -1;
|
||||
goto cleanup_fd;
|
||||
}
|
||||
|
||||
ssize_t written = write(fd, "", 1);
|
||||
if (written != 1) {
|
||||
return -1;
|
||||
goto cleanup_fd;
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user