Whamcloud - gitweb
b=9780
authorgreen <green>
Tue, 3 Jan 2006 22:48:44 +0000 (22:48 +0000)
committergreen <green>
Tue, 3 Jan 2006 22:48:44 +0000 (22:48 +0000)
properly handle O_NOFOLLOW

libsysio/src/open.c

index 717cdfc..132ce39 100644 (file)
@@ -181,6 +181,14 @@ SYSIO_INTERFACE_NAME(open)(const char *path, int flags, ...)
        /*
         * Ask for the open/creat.
         */
+
+#ifdef O_NOFOLLOW
+       if (pno && pno->p_base->pb_ino && (flags & O_NOFOLLOW) &&
+           S_ISLNK(pno->p_base->pb_ino->i_stbuf.st_mode)) {
+               rtn = -ELOOP;
+               goto error;
+       }
+#endif
        rtn = _sysio_open(pno, flags, mode);
        if (rtn)
                goto error;