summaryrefslogtreecommitdiffstats
path: root/utils/nfsd/nfsd.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.com>2016-12-06 11:27:21 -0500
committerSteve Dickson <steved@redhat.com>2016-12-06 11:27:21 -0500
commit29aced680a423e6d97cab4faaae81c3e77eb5fc3 (patch)
tree4ec845d0a536302f9a94a88e1bb421d97d181814 /utils/nfsd/nfsd.c
parentfc1127d754578cd1dc3b52aebce1d5ae09f2d347 (diff)
downloadnfs-utils-29aced680a423e6d97cab4faaae81c3e77eb5fc3.tar.gz
nfs-utils-29aced680a423e6d97cab4faaae81c3e77eb5fc3.tar.xz
nfs-utils-29aced680a423e6d97cab4faaae81c3e77eb5fc3.zip
Remove error messages on xstrdup failure.
xstrdup() prints a messages and exits, except in statd where is prints a message and fails. So there is no point printing an extra message when xstrdup() fails, and except in statd, no point calling exit() as well. So remove some pointless code. Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/nfsd/nfsd.c')
-rw-r--r--utils/nfsd/nfsd.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
index 7b5e67a..9a65877 100644
--- a/utils/nfsd/nfsd.c
+++ b/utils/nfsd/nfsd.c
@@ -27,6 +27,7 @@
#include "nfslib.h"
#include "nfssvc.h"
#include "xlog.h"
+#include "xcommon.h"
#ifndef NFSD_NPROC
#define NFSD_NPROC 8
@@ -67,23 +68,9 @@ main(int argc, char **argv)
int grace = -1;
int lease = -1;
- progname = strdup(basename(argv[0]));
- if (!progname) {
- fprintf(stderr, "%s: unable to allocate memory.\n", argv[0]);
- exit(1);
- }
-
- port = strdup("nfs");
- if (!port) {
- fprintf(stderr, "%s: unable to allocate memory.\n", progname);
- exit(1);
- }
-
- haddr = malloc(sizeof(char *));
- if (!haddr) {
- fprintf(stderr, "%s: unable to allocate memory.\n", progname);
- exit(1);
- }
+ progname = xstrdup(basename(argv[0]));
+ port = xstrdup("nfs");
+ haddr = xmalloc(sizeof(char *));
haddr[0] = NULL;
xlog_syslog(0);
@@ -103,12 +90,7 @@ main(int argc, char **argv)
exit(1);
}
}
- haddr[hcounter] = strdup(optarg);
- if (!haddr[hcounter]) {
- fprintf(stderr, "%s: unable to allocate "
- "memory.\n", progname);
- exit(1);
- }
+ haddr[hcounter] = xstrdup(optarg);
hcounter++;
break;
case 'P': /* XXX for nfs-server compatibility */
@@ -121,12 +103,7 @@ main(int argc, char **argv)
usage(progname);
}
free(port);
- port = strdup(optarg);
- if (!port) {
- fprintf(stderr, "%s: unable to allocate "
- "memory.\n", progname);
- exit(1);
- }
+ port = xstrdup(optarg);
break;
case 'r':
rdma_port = "nfsrdma";