NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/60599: getfsspecname(3) returns ESRCH instead of ENOENT
>Number: 60599
>Category: lib
>Synopsis: getfsspecname(3) returns ESRCH instead of ENOENT
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Aug 15 09:20:01 +0000 2026
>Originator: RVP
>Release: 11.99.7
>Organization:
>Environment:
NetBSD CoreBook.local 11.99.7 NetBSD 11.99.7 (COREBOOK_DIAG) #0: Sat Aug 15 04:21:15 UTC 2026 bld@CoreBook.local:/tmp/obj/usr/src/sys/arch/amd64/compile/COREBOOK_DIAG amd64
>Description:
The return value of getfsspecname(3) when a label cannot be looked up
is a bit confusing:
```
$ sudo mount -r NAME=doesnotexist /mnt
mount: no match for `doesnotexist': No such process
$
```
`No such process'? Wat? There be no "process" here, mon.
>How-To-Repeat:
As above.
>Fix:
---START patch---
--- lib/libutil/getfsspecname.c.orig 2018-12-27 21:35:48.000000000 +0000
+++ lib/libutil/getfsspecname.c 2026-08-13 02:15:29.812375998 +0000
@@ -135,13 +135,16 @@
goto out;
}
+ savee = 0;
for (dk = strtok(drives, " "); dk != NULL; dk = strtok(NULL, " ")) {
struct dkwedge_info dkw;
if (strncmp(dk, "dk", 2) != 0)
continue;
fd = opendisk(dk, O_RDONLY, buf, bufsiz, 0);
- if (fd == -1)
+ if (fd == -1) {
+ savee = errno;
continue;
+ }
if (ioctl(fd, DIOCGWEDGEINFO, &dkw) == -1) {
savee = errno;
snprintf(buf, bufsiz, "%s: getwedgeinfo", dk);
@@ -161,9 +164,11 @@
close(fd);
p = strstr(buf, "/r");
goto good;
- }
+ } else
+ savee = errno;
#endif
- savee = ESRCH;
+ if (savee == 0)
+ savee = ENOENT;
snprintf(buf, bufsiz, "no match for `%s'", vname);
out:
buf = NULL;
---END patch---
Home |
Main Index |
Thread Index |
Old Index