diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2010-10-08 15:45:35 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2010-10-08 15:45:35 +0000 |
commit | 6d9451d08129220313fbcd503a14a8bb02644a59 (patch) | |
tree | 4cb77b21f7e2cc687a5f2392d2ff5b1fcda8efb0 /usr.sbin/ikectl | |
parent | 91f5f191466637fb118211efd5b51f5e6a0c5d55 (diff) |
check if a directory exists before trying to create it in the export
case as well, spotted by mikeb
Diffstat (limited to 'usr.sbin/ikectl')
-rw-r--r-- | usr.sbin/ikectl/ikeca.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/ikectl/ikeca.c b/usr.sbin/ikectl/ikeca.c index 9388ea61c7b..06547afd214 100644 --- a/usr.sbin/ikectl/ikeca.c +++ b/usr.sbin/ikectl/ikeca.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ikeca.c,v 1.17 2010/10/08 11:41:56 jsg Exp $ */ +/* $OpenBSD: ikeca.c,v 1.18 2010/10/08 15:45:34 jsg Exp $ */ /* $vantronix: ikeca.c,v 1.13 2010/06/03 15:52:52 reyk Exp $ */ /* @@ -591,7 +591,8 @@ ca_export(struct ca *ca, char *keyname, char *myname, char *password) for (i = 0; i < nitems(hier); i++) { strlcpy(dst, p, sizeof(dst)); strlcat(dst, hier[i].dir, sizeof(dst)); - if (mkdir(dst, hier[i].mode) != 0) + if (stat(dst, &st) != 0 && errno == ENOENT && + mkdir(dst, hier[i].mode) != 0) err(1, "failed to create dir %s", dst); } |