From 809b75d37898c698c5cdf402a73b964d7ecbb51e Mon Sep 17 00:00:00 2001 From: claudio Date: Tue, 2 Mar 2021 09:23:59 +0000 Subject: [PATCH] There is no longer the need to mkpathat(), the main process runs now from the cachedir. --- usr.sbin/rpki-client/extern.h | 4 ++-- usr.sbin/rpki-client/main.c | 4 ++-- usr.sbin/rpki-client/mkdir.c | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/usr.sbin/rpki-client/extern.h b/usr.sbin/rpki-client/extern.h index ec7ad26ac69..17face16f84 100644 --- a/usr.sbin/rpki-client/extern.h +++ b/usr.sbin/rpki-client/extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: extern.h,v 1.48 2021/03/02 09:08:59 claudio Exp $ */ +/* $OpenBSD: extern.h,v 1.49 2021/03/02 09:23:59 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -448,7 +448,7 @@ int output_json(FILE *, struct vrp_tree *, struct stats *); void logx(const char *fmt, ...) __attribute__((format(printf, 1, 2))); -int mkpathat(int, const char *); +int mkpath(const char *); #define RPKI_PATH_OUT_DIR "/var/db/rpki-client" #define RPKI_PATH_BASE_DIR "/var/cache/rpki-client" diff --git a/usr.sbin/rpki-client/main.c b/usr.sbin/rpki-client/main.c index b69c6b9a594..9d5740bcb7a 100644 --- a/usr.sbin/rpki-client/main.c +++ b/usr.sbin/rpki-client/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.107 2021/03/02 09:08:59 claudio Exp $ */ +/* $OpenBSD: main.c,v 1.108 2021/03/02 09:23:59 claudio Exp $ */ /* * Copyright (c) 2019 Kristaps Dzonsons * @@ -297,7 +297,7 @@ repo_fetch(struct repo *rp) * will not build the destination for us. */ - if (mkpathat(cachefd, rp->local) == -1) + if (mkpath(rp->local) == -1) err(1, "%s", rp->local); logx("%s: pulling from network", rp->local); diff --git a/usr.sbin/rpki-client/mkdir.c b/usr.sbin/rpki-client/mkdir.c index e9a349feef6..228b7e3a0f9 100644 --- a/usr.sbin/rpki-client/mkdir.c +++ b/usr.sbin/rpki-client/mkdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkdir.c,v 1.3 2021/02/22 09:46:05 claudio Exp $ */ +/* $OpenBSD: mkdir.c,v 1.4 2021/03/02 09:23:59 claudio Exp $ */ /* * Copyright (c) 1983, 1992, 1993 @@ -37,14 +37,13 @@ #include "extern.h" /* - * mkpathat -- create directories. - * dirfd - file descriptor for local directory + * mkpath -- create directories. * path - path * mode - file mode of terminal directory * dir_mode - file mode of intermediate directories */ int -mkpathat(int dirfd, const char *dir) +mkpath(const char *dir) { char *path, *slash; int done; @@ -60,7 +59,7 @@ mkpathat(int dirfd, const char *dir) done = (*slash == '\0'); *slash = '\0'; - if (mkdirat(dirfd, path, 0700) == -1 && errno != EEXIST) { + if (mkdir(path, 0755) == -1 && errno != EEXIST) { free(path); return (-1); } -- 2.20.1