NetBSD Problem Report #431

From gnats  Mon Aug 22 12:15:58 1994
Received: from localhost (root@cis-ts3-slip4.cis.brown.edu [128.148.19.58]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id MAA00474 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 22 Aug 1994 12:15:49 -0700
Message-Id: <199408220522.BAA02130@cis-ts3-slip4.cis.brown.edu>
Date: Mon, 22 Aug 1994 01:22:21 -0400
From: Mark Weaver <mhw@cs.brown.edu>
Reply-To: mhw@cs.brown.edu
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: umount(1) doesn't return error codes properly
X-Send-Pr-Version: 3.2

>Number:         431
>Category:       bin
>Synopsis:       umount(1) doesn't return error codes properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   mhw
>Arrival-Date:   Mon Aug 22 12:20:03 +0000 1994
>Closed-Date:    Fri Sep 16 02:59:10 +0000 1994
>Last-Modified:  
>Originator:     Mark Weaver
>Release:        NetBSD 1.0_BETA (15-July-1994)
>Organization:
--------------------------------------------------------------------
Email: Mark_Weaver@brown.edu           | Brown University
PGP Key: finger mhw@cs.brown.edu       | Dept of Computer Science
>Environment:

System: NetBSD cis-ts3-slip4.cis.brown.edu 1.0_BETA NetBSD 1.0_BETA (EXCELSIOR) #2: Mon Aug 22 00:02:40 EDT 1994 mhw@excelsior.cis.brown.edu:/usr/src/sys/arch/i386/compile/EXCELSIOR i386

>Description:
	umount(1) doesn't return error codes properly.  umountfs() in
	umount.c can't decide whether returning 0 or 1 signifies an
	error.  From looking at the last call to umountfs() from main(),
	it appears that 0 signifies an error.  From looking at where
	umountall() calls umountfs(), it appears that 1 signifies an
	error.  Within umountfs() itself, some errors cause 0 to be
	returned and some cause 1 to be returned.

	The majority of the code seems to think that 1 signifies an error,
	and that is consistent with umountall() as well, so I decided to
	go with that.

>How-To-Repeat:

	umount ....
	echo $?

	notice that even though the umount succeeded and didn't print an
	error, that the result code is 1.

>Fix:
diff -c  src/sbin/umount/umount.c.mhw1 src/sbin/umount/umount.c
*** src/sbin/umount/umount.c.mhw1	Thu Jun  9 06:11:44 1994
--- src/sbin/umount/umount.c	Mon Aug 22 01:14:35 1994
***************
*** 129,135 ****
  		errs = umountall();
  	} else
  		for (errs = 0; *argv != NULL; ++argv)
! 			if (umountfs(*argv) == 0)
  				errs = 1;
  	exit(errs);
  }
--- 129,135 ----
  		errs = umountall();
  	} else
  		for (errs = 0; *argv != NULL; ++argv)
! 			if (umountfs(*argv))
  				errs = 1;
  	exit(errs);
  }
***************
*** 186,192 ****

  	if (realpath(name, rname) == NULL) {
  		warn("%s", rname);
! 		return (0);
  	}

  	name = rname;
--- 186,192 ----

  	if (realpath(name, rname) == NULL) {
  		warn("%s", rname);
! 		return (1);
  	}

  	name = rname;
***************
*** 214,220 ****
  	}

  	if (!selected(type))
! 		return (0);

  	if ((delimp = strchr(name, '@')) != NULL) {
  		hostp = delimp + 1;
--- 214,220 ----
  	}

  	if (!selected(type))
! 		return (1);

  	if ((delimp = strchr(name, '@')) != NULL) {
  		hostp = delimp + 1;
***************
*** 230,236 ****
  	} else
  		hp = NULL;
  	if (!namematch(hp))
! 		return (0);

  	if (vflag)
  		(void)printf("%s: unmount from %s\n", name, mntpt);
--- 230,236 ----
  	} else
  		hp = NULL;
  	if (!namematch(hp))
! 		return (1);

  	if (vflag)
  		(void)printf("%s: unmount from %s\n", name, mntpt);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Thu Sep 15 19:59:10 PDT 1994 
State-Changed-Why:  
This has been fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.