Check return value of chmod() and fcntl()

This commit is contained in:
Miroslav Lichvar
2014-06-06 12:07:31 +02:00
parent 9b630a0664
commit a8693a21f8
4 changed files with 15 additions and 9 deletions

6
util.c
View File

@@ -647,7 +647,7 @@ UTI_FloatHostToNetwork(double x)
/* ================================================== */
void
int
UTI_FdSetCloexec(int fd)
{
int flags;
@@ -655,8 +655,10 @@ UTI_FdSetCloexec(int fd)
flags = fcntl(fd, F_GETFD);
if (flags != -1) {
flags |= FD_CLOEXEC;
fcntl(fd, F_SETFD, flags);
return !fcntl(fd, F_SETFD, flags);
}
return 0;
}
/* ================================================== */