From: claudio Date: Thu, 3 Jun 2021 15:10:05 +0000 (+0000) Subject: Use O_DIRECTORY when opening directories. This makes some errors a bit X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8b9626e525dd5ccb8a6820339ee84864a704d49b;p=openbsd Use O_DIRECTORY when opening directories. This makes some errors a bit clearer when using -d. OK deraadt@ --- diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index 40bb51d869c..41c04695a58 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.141 2021/05/11 11:48:02 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.142 2021/06/03 15:10:05 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -701,9 +701,9 @@ main(int argc, char *argv[]) goto usage; } - if ((cachefd = open(cachedir, O_RDONLY, 0)) == -1) + if ((cachefd = open(cachedir, O_RDONLY | O_DIRECTORY, 0)) == -1) err(1, "cache directory %s", cachedir); - if ((outdirfd = open(outputdir, O_RDONLY, 0)) == -1) + if ((outdirfd = open(outputdir, O_RDONLY | O_DIRECTORY, 0)) == -1) err(1, "output directory %s", outputdir); if (outformats == 0)