summaryrefslogtreecommitdiff
path: root/util-linux/nfsmount.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-07-14 01:51:25 +0000
committerMatt Kraai <kraai@debian.org>2000-07-14 01:51:25 +0000
commitd537a95fdbc0b4a5f38edea8593b4c085fdd7fcb (patch)
tree62127f20fc07758e445d8c4e186306cbe83d77b1 /util-linux/nfsmount.c
parent4ac6cb534d78d63d7b0a206118c56bad7024b9f8 (diff)
downloadbusybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.gz
busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.tar.bz2
busybox-w32-d537a95fdbc0b4a5f38edea8593b4c085fdd7fcb.zip
Use errorMsg rather than fprintf.
Diffstat (limited to 'util-linux/nfsmount.c')
-rw-r--r--util-linux/nfsmount.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index 8cdfebfce..ad0b5842d 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -312,8 +312,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
312 msock = fsock = -1; 312 msock = fsock = -1;
313 mclient = NULL; 313 mclient = NULL;
314 if (strlen(spec) >= sizeof(hostdir)) { 314 if (strlen(spec) >= sizeof(hostdir)) {
315 fprintf(stderr, _("mount: " 315 errorMsg("excessively long host:dir argument\n");
316 "excessively long host:dir argument\n"));
317 goto fail; 316 goto fail;
318 } 317 }
319 strcpy(hostdir, spec); 318 strcpy(hostdir, spec);
@@ -325,12 +324,10 @@ int nfsmount(const char *spec, const char *node, int *flags,
325 until they can be fully supported. (mack@sgi.com) */ 324 until they can be fully supported. (mack@sgi.com) */
326 if ((s = strchr(hostdir, ','))) { 325 if ((s = strchr(hostdir, ','))) {
327 *s = '\0'; 326 *s = '\0';
328 fprintf(stderr, _("mount: warning: " 327 errorMsg("warning: multiple hostnames not supported\n");
329 "multiple hostnames not supported\n"));
330 } 328 }
331 } else { 329 } else {
332 fprintf(stderr, _("mount: " 330 errorMsg("directory to mount not in host:dir format\n");
333 "directory to mount not in host:dir format\n"));
334 goto fail; 331 goto fail;
335 } 332 }
336 333
@@ -340,13 +337,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
340#endif 337#endif
341 { 338 {
342 if ((hp = gethostbyname(hostname)) == NULL) { 339 if ((hp = gethostbyname(hostname)) == NULL) {
343 fprintf(stderr, _("mount: can't get address for %s\n"), 340 errorMsg("can't get address for %s\n", hostname);
344 hostname);
345 goto fail; 341 goto fail;
346 } else { 342 } else {
347 if (hp->h_length > sizeof(struct in_addr)) { 343 if (hp->h_length > sizeof(struct in_addr)) {
348 fprintf(stderr, 344 errorMsg("got bad hp->h_length\n");
349 _("mount: got bad hp->h_length\n"));
350 hp->h_length = sizeof(struct in_addr); 345 hp->h_length = sizeof(struct in_addr);
351 } 346 }
352 memcpy(&server_addr.sin_addr, 347 memcpy(&server_addr.sin_addr,
@@ -363,8 +358,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
363 if (!old_opts) 358 if (!old_opts)
364 old_opts = ""; 359 old_opts = "";
365 if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) { 360 if (strlen(old_opts) + strlen(s) + 10 >= sizeof(new_opts)) {
366 fprintf(stderr, _("mount: " 361 errorMsg("excessively long option argument\n");
367 "excessively long option argument\n"));
368 goto fail; 362 goto fail;
369 } 363 }
370 sprintf(new_opts, "%s%saddr=%s", 364 sprintf(new_opts, "%s%saddr=%s",
@@ -524,11 +518,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
524 data.flags |= (nolock ? NFS_MOUNT_NONLM : 0); 518 data.flags |= (nolock ? NFS_MOUNT_NONLM : 0);
525#endif 519#endif
526 if (nfsvers > MAX_NFSPROT) { 520 if (nfsvers > MAX_NFSPROT) {
527 fprintf(stderr, "NFSv%d not supported!\n", nfsvers); 521 errorMsg("NFSv%d not supported!\n", nfsvers);
528 return 0; 522 return 0;
529 } 523 }
530 if (mountvers > MAX_NFSPROT) { 524 if (mountvers > MAX_NFSPROT) {
531 fprintf(stderr, "NFSv%d not supported!\n", nfsvers); 525 errorMsg("NFSv%d not supported!\n", nfsvers);
532 return 0; 526 return 0;
533 } 527 }
534 if (nfsvers && !mountvers) 528 if (nfsvers && !mountvers)
@@ -588,13 +582,11 @@ int nfsmount(const char *spec, const char *node, int *flags,
588 mount_server_addr.sin_addr.s_addr = inet_addr(hostname); 582 mount_server_addr.sin_addr.s_addr = inet_addr(hostname);
589 } else { 583 } else {
590 if ((hp = gethostbyname(mounthost)) == NULL) { 584 if ((hp = gethostbyname(mounthost)) == NULL) {
591 fprintf(stderr, _("mount: can't get address for %s\n"), 585 errorMsg("can't get address for %s\n", hostname);
592 hostname);
593 goto fail; 586 goto fail;
594 } else { 587 } else {
595 if (hp->h_length > sizeof(struct in_addr)) { 588 if (hp->h_length > sizeof(struct in_addr)) {
596 fprintf(stderr, 589 errorMsg("got bad hp->h_length?\n");
597 _("mount: got bad hp->h_length?\n"));
598 hp->h_length = sizeof(struct in_addr); 590 hp->h_length = sizeof(struct in_addr);
599 } 591 }
600 mount_server_addr.sin_family = AF_INET; 592 mount_server_addr.sin_family = AF_INET;
@@ -729,8 +721,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
729 721
730 if (nfsvers == 2) { 722 if (nfsvers == 2) {
731 if (status.nfsv2.fhs_status != 0) { 723 if (status.nfsv2.fhs_status != 0) {
732 fprintf(stderr, 724 errorMsg("%s:%s failed, reason given by server: %s\n",
733 "mount: %s:%s failed, reason given by server: %s\n",
734 hostname, dirname, 725 hostname, dirname,
735 nfs_strerror(status.nfsv2.fhs_status)); 726 nfs_strerror(status.nfsv2.fhs_status));
736 goto fail; 727 goto fail;
@@ -748,8 +739,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
748#if NFS_MOUNT_VERSION >= 4 739#if NFS_MOUNT_VERSION >= 4
749 fhandle3 *fhandle; 740 fhandle3 *fhandle;
750 if (status.nfsv3.fhs_status != 0) { 741 if (status.nfsv3.fhs_status != 0) {
751 fprintf(stderr, 742 errorMsg("%s:%s failed, reason given by server: %s\n",
752 "mount: %s:%s failed, reason given by server: %s\n",
753 hostname, dirname, 743 hostname, dirname,
754 nfs_strerror(status.nfsv3.fhs_status)); 744 nfs_strerror(status.nfsv3.fhs_status));
755 goto fail; 745 goto fail;