Use the dirfd() macro instead of accessing struct _dirdesc directly.
authorSascha Wildner <saw@online.de>
Mon, 5 Jan 2015 09:38:31 +0000 (10:38 +0100)
committerSascha Wildner <saw@online.de>
Mon, 5 Jan 2015 09:38:31 +0000 (10:38 +0100)
This is in preparation for making dirfd() a function (for POSIX
conformance) and struct _dirdesc private.

usr.bin/rdist/expand.c
usr.sbin/lpr/common_source/common.c

index 1fe6e04..366f73f 100644 (file)
@@ -293,7 +293,7 @@ matchdir(char *pattern)
                        return;
                goto patherr2;
        }
-       if (fstat(dirp->dd_fd, &stb) < 0)
+       if (fstat(dirfd(dirp), &stb) < 0)
                goto patherr1;
        if (!ISDIR(stb.st_mode)) {
                errno = ENOTDIR;
index 7c371ae..4adea63 100644 (file)
@@ -116,7 +116,7 @@ getq(const struct printer *pp, struct jobqueue *(*namelist[]))
                seteuid(uid);
                return (-1);
        }
-       if (fstat(dirp->dd_fd, &stbuf) < 0)
+       if (fstat(dirfd(dirp), &stbuf) < 0)
                goto errdone;
        seteuid(uid);