summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhjl <hjl>2001-05-28 18:37:30 +0000
committerhjl <hjl>2001-05-28 18:37:30 +0000
commit63049fd3c95c67df5ac175c746f8ec9058f8a76c (patch)
tree95ec382a3ba940674829f2e994351c7eedf0324d
parent86ae664e66c439354cb4f959e9f289059e7760a4 (diff)
downloadnfs-utils-63049fd3c95c67df5ac175c746f8ec9058f8a76c.tar.gz
nfs-utils-63049fd3c95c67df5ac175c746f8ec9058f8a76c.tar.xz
nfs-utils-63049fd3c95c67df5ac175c746f8ec9058f8a76c.zip
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.
-rw-r--r--ChangeLog7
-rw-r--r--utils/lockd/lockd.c8
-rw-r--r--utils/mountd/mountd.c7
-rw-r--r--utils/nfsd/nfsd.c9
-rw-r--r--utils/rquotad/rquota_svc.c8
5 files changed, 39 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 1760d41..1630d21 100644
--- 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
diff --git a/utils/lockd/lockd.c b/utils/lockd/lockd.c
index 900510b..49183d2 100644
--- a/utils/lockd/lockd.c
+++ b/utils/lockd/lockd.c
@@ -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
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index 8779afe..14f5fa2 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -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"); */
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 3a22370..c1cb56f 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -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 */
diff --git a/utils/rquotad/rquota_svc.c b/utils/rquotad/rquota_svc.c
index 104ba7e..e114966 100644
--- a/utils/rquotad/rquota_svc.c
+++ b/utils/rquotad/rquota_svc.c
@@ -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);