As far as I understand, the basename() here is specifically intended
to skip a leading "/dev/". So how about doing this expressly?
Do we want to use _PATH_DEV or "/dev/"? There's a "/dev/rst%d" a
few lines outside of the diff context...
Index: bin/chio/parse.y
===================================================================
RCS file: /cvs/src/bin/chio/parse.y,v
retrieving revision 1.22
diff -u -p -r1.22 parse.y
--- bin/chio/parse.y 13 Feb 2019 22:57:07 -0000 1.22
+++ bin/chio/parse.y 13 Oct 2020 19:23:22 -0000
@@ -29,6 +29,7 @@
#include <err.h>
#include <libgen.h>
#include <limits.h>
+#include <paths.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
@@ -445,10 +446,12 @@ parse_tapedev(const char *filename, cons
errors = file->errors;
popfile();
+ if (strncmp(changer, _PATH_DEV, sizeof(_PATH_DEV) - 1) == 0)
+ changer += sizeof(_PATH_DEV) - 1;
TAILQ_FOREACH(p, &changers, entry) {
- if (strcmp(basename(changer), p->name) == 0) {
+ if (strcmp(changer, p->name) == 0) {
if (drive >= 0 && drive < p->drivecnt) {
- if (asprintf(&tapedev, "/dev/%s",
+ if (asprintf(&tapedev, _PATH_DEV "%s",
p->drives[drive]) == -1)
errx(1, "malloc failed");
} else
--
Christian "naddy" Weisgerber [email protected]