|
|
|
@ -1,35 +0,0 @@ |
|
|
|
#include <unistd.h> |
|
|
|
#include <string.h> |
|
|
|
#include <fcntl.h> |
|
|
|
#include <err.h> |
|
|
|
#include <sys/errno.h> |
|
|
|
#include <sys/time.h> |
|
|
|
#include <sys/param.h> /* MAXPATHLEN */ |
|
|
|
|
|
|
|
|
|
|
|
int |
|
|
|
_futimesat(int fd, const char* path, struct timeval *tvp) { |
|
|
|
char fullpath[MAXPATHLEN]; |
|
|
|
|
|
|
|
// Handle absolute paths |
|
|
|
if(path[0] == '/') { |
|
|
|
return ::utimes(path,tvp); |
|
|
|
} |
|
|
|
|
|
|
|
// OS X 10.12 (at least) has an issue with using AT_FDCWD in this specific call. |
|
|
|
if (fd == AT_FDCWD) { |
|
|
|
if (getcwd((char*)fullpath, MAXPATHLEN) == NULL) { |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (fcntl(fd,F_GETPATH,fullpath) < 0) { |
|
|
|
return -1; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (strlcat(fullpath, "/", MAXPATHLEN) > MAXPATHLEN || strlcat(fullpath, path, MAXPATHLEN) > MAXPATHLEN) { |
|
|
|
return (errno=ENAMETOOLONG,-1); |
|
|
|
} |
|
|
|
|
|
|
|
return ::utimes(fullpath,tvp);; |
|
|
|
} |