From 63049fd3c95c67df5ac175c746f8ec9058f8a76c Mon Sep 17 00:00:00 2001 From: hjl Date: Mon, 28 May 2001 18:37:30 +0000 Subject: [PATCH] 2001-05-28 H.J. Lu * 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 | 7 +++++++ utils/lockd/lockd.c | 8 ++++++++ utils/mountd/mountd.c | 7 +++++++ utils/nfsd/nfsd.c | 9 +++++++++ utils/rquotad/rquota_svc.c | 8 ++++++++ 5 files changed, 39 insertions(+) diff --git a/ChangeLog b/ChangeLog index 1760d41..1630d21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-05-28 H.J. Lu + + * 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 * 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 +#include +#include #include #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 #include #include +#include #include #include #include @@ -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 #include +#include +#include +#include #include #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 +#include #include #include "rquota.h" #include @@ -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); -- 2.39.5