tweaks
[tridge/junkcode.git] / fd_filename.c
1 #include <sys/types.h>
2 #include <utime.h>
3 #include <stdio.h>
4 #include <errno.h>
5
6
7
8 int fd_utime(int fd, struct utimbuf *buf)
9 {
10         char *fd_path = NULL;
11         int ret;
12
13         asprintf(&fd_path, "/proc/self/%d", fd);
14         if (!fd_path) {
15                 errno = ENOMEM;
16                 return -1;
17         }
18
19         ret = utime(fd_path, buf);
20         free(fd_path);
21         return ret;
22 }