From e6990a6041e84fd64949030683fdf9c03a572664 Mon Sep 17 00:00:00 2001 From: millert Date: Mon, 12 Jun 2017 18:56:13 +0000 Subject: [PATCH] Use unlinkat() when removing the contents of a directory so we don't need to construct paths. OK deraadt@ --- usr.sbin/ypbind/ypbind.c | 6 ++---- 1 file 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 @@ -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 { -- 2.20.1