summaryrefslogtreecommitdiff
path: root/usr.sbin/ypbind
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2017-06-12 18:56:14 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2017-06-12 18:56:14 +0000
commitc4bfa9353d589aa0c7e68355ee35dcd11498c31c (patch)
tree5e0d1c1ffa0c99d733db19e44032b732d9a0307f /usr.sbin/ypbind
parent3e2db8aa45f3a91cf4a9310fa83548f8af76dbfb (diff)
Use unlinkat() when removing the contents of a directory so we don't
need to construct paths. OK deraadt@
Diffstat (limited to 'usr.sbin/ypbind')
-rw-r--r--usr.sbin/ypbind/ypbind.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/usr.sbin/ypbind/ypbind.c b/usr.sbin/ypbind/ypbind.c
index 34bb8f9a43a..7b1a85c0918 100644
--- a/usr.sbin/ypbind/ypbind.c
+++ b/usr.sbin/ypbind/ypbind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ypbind.c,v 1.69 2017/02/17 16:46:17 ajacoutot Exp $ */
+/* $OpenBSD: ypbind.c,v 1.70 2017/06/12 18:56:13 millert Exp $ */
/*
* Copyright (c) 1992, 1993, 1996, 1997, 1998 Theo de Raadt <deraadt@openbsd.org>
@@ -369,9 +369,7 @@ main(int argc, char *argv[])
if (!strcmp(dent->d_name, ".") ||
!strcmp(dent->d_name, ".."))
continue;
- snprintf(path, sizeof(path), "%s/%s", BINDINGDIR,
- dent->d_name);
- (void) unlink(path);
+ (void)unlinkat(dirfd(dirp), dent->d_name, 0);
}
closedir(dirp);
} else {