math: sinh.c cleanup similar to the cosh one
[musl] / src / misc / realpath.c
index ef156fc..1833514 100644 (file)
@@ -6,7 +6,7 @@
 #include <errno.h>
 #include <unistd.h>
 
-char *realpath(const char *filename, char *resolved)
+char *realpath(const char *restrict filename, char *restrict resolved)
 {
        int fd;
        ssize_t r;
@@ -19,7 +19,7 @@ char *realpath(const char *filename, char *resolved)
                return 0;
        }
 
-       fd = open(filename, O_RDONLY|O_NONBLOCK);
+       fd = open(filename, O_RDONLY|O_NONBLOCK|O_CLOEXEC);
        if (fd < 0) return 0;
        snprintf(buf, sizeof buf, "/proc/self/fd/%d", fd);