diff --git a/usr.sbin/certctl/Makefile b/usr.sbin/certctl/Makefile index 5430dbf2485..6900f0ce3b6 100644 --- a/usr.sbin/certctl/Makefile +++ b/usr.sbin/certctl/Makefile @@ -7,4 +7,8 @@ LIBADD= crypto HAS_TESTS= SUBDIR.${MK_TESTS}= tests +.ifdef BOOTSTRAPPING +CFLAGS+=-DBOOTSTRAPPING +.endif + .include diff --git a/usr.sbin/certctl/certctl.c b/usr.sbin/certctl/certctl.c index 6687e56f23b..365870167ae 100644 --- a/usr.sbin/certctl/certctl.c +++ b/usr.sbin/certctl/certctl.c @@ -387,7 +387,12 @@ write_certs(const char *dir, struct cert_tree *tree) * Open and scan the directory. */ if ((d = open(dir, O_DIRECTORY | O_RDONLY)) < 0 || - (ndents = fdscandir(d, &dents, NULL, lexisort)) < 0) +#ifdef BOOTSTRAPPING + (ndents = scandir(dir, &dents, NULL, lexisort)) +#else + (ndents = fdscandir(d, &dents, NULL, lexisort)) +#endif + < 0) err(1, "%s", dir); /* * Iterate over the directory listing and the certificate listing