2001-05-28 H.J. Lu <hjl@lucon.org>
authorhjl <hjl>
Mon, 28 May 2001 18:37:30 +0000 (18:37 +0000)
committerhjl <hjl>
Mon, 28 May 2001 18:37:30 +0000 (18:37 +0000)
* utils/lockd/lockd.c (main): chdir to NFS_STATEDIR.
* utils/mountd/mountd.c (main): Likewise.
* utils/nfsd/nfsd.c (main): Likewise.
* utils/rquotad/rquota_svc.c (main): Likewise.

ChangeLog
utils/lockd/lockd.c
utils/mountd/mountd.c
utils/nfsd/nfsd.c
utils/rquotad/rquota_svc.c

index 1760d41..1630d21 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2001-05-28  H.J. Lu <hjl@lucon.org>
+
+       * utils/lockd/lockd.c (main): chdir to NFS_STATEDIR.
+       * utils/mountd/mountd.c (main): Likewise.
+       * utils/nfsd/nfsd.c (main): Likewise.
+       * utils/rquotad/rquota_svc.c (main): Likewise.
+
 2001-05-06  Anne Milicia <milicia@missioncriticallinux.com>
 
        * support/export/client.c (client_check): Check IP address
index 900510b..49183d2 100644 (file)
@@ -9,6 +9,8 @@
 #include "config.h"
 
 #include <stdio.h>
+#include <unistd.h>
+#include <string.h>
 #include <errno.h>
 #include "nfslib.h"
 
@@ -22,6 +24,12 @@ main(int argc, char **argv)
        if (argc > 1)
                usage (argv [0]);
 
+       if (chdir(NFS_STATEDIR)) {
+               fprintf(stderr, "%s: chdir(%s) failed: %s\n",
+                       argv [0], NFS_STATEDIR, strerror(errno));
+               exit(1);
+       }
+
        if ((error = lockdsvc()) < 0) {
                if (errno == EINVAL)
                        /* Ignore EINVAL since kernel may start
index 8779afe..14f5fa2 100644 (file)
@@ -14,6 +14,7 @@
 #include <arpa/inet.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <string.h>
 #include <getopt.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -440,6 +441,12 @@ main(int argc, char **argv)
        if (optind != argc || !(nfs_version & 0x7))
                usage(argv [0], 1);
 
+       if (chdir(NFS_STATEDIR)) {
+               fprintf(stderr, "%s: chdir(%s) failed: %s\n",
+                       argv [0], NFS_STATEDIR, strerror(errno));
+               exit(1);
+       }
+
        /* Initialize logging. */
 /*     xlog_open("mountd"); */
 
index 3a22370..c1cb56f 100644 (file)
@@ -11,6 +11,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
 #include <getopt.h>
 #include "nfslib.h"
 
@@ -43,6 +46,12 @@ main(int argc, char **argv)
                }
        }
 
+       if (chdir(NFS_STATEDIR)) {
+               fprintf(stderr, "%s: chdir(%s) failed: %s\n",
+                       argv [0], NFS_STATEDIR, strerror(errno));
+               exit(1);
+       }
+
        if (optind < argc) {
                if ((count = atoi(argv[optind])) < 0) {
                        /* insane # of servers */
index 104ba7e..e114966 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include <unistd.h>
+#include <errno.h>
 #include <rpc/rpc.h>
 #include "rquota.h"
 #include <stdlib.h>
@@ -254,6 +255,13 @@ int main(int argc, char **argv)
      }
    }
 
+   if (chdir(NFS_STATEDIR)) {
+     fprintf(stderr, "%s: chdir(%s) failed: %s\n",
+            argv [0], NFS_STATEDIR, strerror(errno));
+
+     exit(1);
+   }
+
    /* WARNING: the following works on Linux and SysV, but not BSD! */
    signal(SIGCHLD, SIG_IGN);