summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-03-02 06:22:22 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-03-02 06:22:22 +0000
commit5eeb23423bf13599fadd3721d4f36a6746550892 (patch)
treea1caeb431cd24fc8ccccb5f93a7cede805d2cdff /usr.sbin
parentaf92c039143e5b6cbd3271ee2865d1b0e933de31 (diff)
if auto_dir does not exist, create it
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/amd/amd/amd.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/amd/amd/amd.c b/usr.sbin/amd/amd/amd.c
index 558ab417e12..65f8b1382b0 100644
--- a/usr.sbin/amd/amd/amd.c
+++ b/usr.sbin/amd/amd/amd.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)amd.c 8.1 (Berkeley) 6/6/93
- * $Id: amd.c,v 1.1 1995/10/18 08:47:10 deraadt Exp $
+ * $Id: amd.c,v 1.2 2001/03/02 06:22:21 deraadt Exp $
*/
#ifndef lint
@@ -50,11 +50,17 @@ static char copyright[] =
*/
#include "am.h"
-#include <sys/signal.h>
+#include <signal.h>
#include <sys/ioctl.h>
+#include <sys/stat.h>
#include <fcntl.h>
+#include <unistd.h>
#include <setjmp.h>
+#include <rpc/rpc.h>
+#include <rpcsvc/ypclnt.h>
+#include <rpcsvc/yp_prot.h>
+
char pid_fsname[16 + MAXHOSTNAMELEN]; /* "kiska.southseas.nz:(pid%d)" */
char *progname; /* "amd" */
#ifdef HAS_HOST
@@ -186,6 +192,7 @@ static int daemon_mode(P_void)
return getppid();
}
+int
main(argc, argv)
int argc;
char *argv[];
@@ -244,7 +251,7 @@ char *argv[];
* Partially initialise hostd[]. This
* is completed in get_args().
*/
- if (domdot = strchr(hostname, '.')) {
+ if ((domdot = strchr(hostname, '.'))) {
/*
* Hostname already contains domainname.
* Split out hostname and domainname
@@ -292,6 +299,11 @@ char *argv[];
*/
get_args(argc, argv);
+ if (mkdir(auto_dir, 0755) == -1) {
+ if (errno != EEXIST)
+ plog(XLOG_FATAL, "mkdir(autodir = %s: %m", auto_dir);
+ }
+
/*
* Get our own IP address so that we
* can mount the automounter.