switch to new util file functions

Replace all fopen(), rename(), and unlink() calls with the new util
functions.
This commit is contained in:
Miroslav Lichvar
2019-10-22 18:06:25 +02:00
parent 7dfd4ae556
commit e18903a6b5
10 changed files with 49 additions and 149 deletions

View File

@@ -419,7 +419,8 @@ bind_unix_address(int sock_fd, const char *addr, int flags)
}
saddr.un.sun_family = AF_UNIX;
unlink(addr);
if (!UTI_RemoveFile(NULL, addr, NULL))
;
/* PRV_BindSocket() doesn't support Unix sockets yet */
if (bind(sock_fd, &saddr.sa, sizeof (saddr.un)) < 0) {
@@ -1299,12 +1300,8 @@ SCK_RemoveSocket(int sock_fd)
saddr.sa.sa_family != AF_UNIX)
return 0;
if (unlink(saddr.un.sun_path) < 0) {
DEBUG_LOG("unlink(%s) failed : %s", saddr.un.sun_path, strerror(errno));
if (!UTI_RemoveFile(NULL, saddr.un.sun_path, NULL))
return 0;
}
DEBUG_LOG("Removed %s", saddr.un.sun_path);
return 1;
}