aboutsummaryrefslogtreecommitdiff
path: root/toys/other
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-03-02 11:52:38 -0600
committerRob Landley <rob@landley.net>2016-03-02 11:52:38 -0600
commit7ca5dc4232b9ac5ee5cd25c8b5b33a58904cd251 (patch)
tree258fe0d485c5793e19a56be81f9d71e51476f0d8 /toys/other
parent323819c689448fffcf4d3ed20f2485b75ac64b64 (diff)
downloadtoybox-7ca5dc4232b9ac5ee5cd25c8b5b33a58904cd251.tar.gz
For years the man pages have said to #include <sys/types.h> to get
major/minor/makedev, but glibc has vowed to break existing programs (https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html) and replace it with _another_ non-standard header (not in posix or lsb), so let's just add functions to lib/ that do the transform ourselves.
Diffstat (limited to 'toys/other')
-rw-r--r--toys/other/makedevs.c2
-rw-r--r--toys/other/mountpoint.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/toys/other/makedevs.c b/toys/other/makedevs.c
index 0f0a6615..0f79b25f 100644
--- a/toys/other/makedevs.c
+++ b/toys/other/makedevs.c
@@ -99,7 +99,7 @@ void makedevs_main()
perror_msg("line %d: file '%s' does not exist", line_no, ptr);
continue;
}
- } else if (mknod(ptr, mode, makedev(major, minor + i*incr))) {
+ } else if (mknod(ptr, mode, dev_makedev(major, minor + i*incr))) {
perror_msg("line %d: can't create node '%s'", line_no, ptr);
continue;
}
diff --git a/toys/other/mountpoint.c b/toys/other/mountpoint.c
index ce1d23cd..98e1d309 100644
--- a/toys/other/mountpoint.c
+++ b/toys/other/mountpoint.c
@@ -37,7 +37,8 @@ void mountpoint_main(void)
if (toys.optflags & FLAG_x) {
if (S_ISBLK(st1.st_mode)) {
- if (!quiet) printf("%u:%u\n", major(st1.st_rdev), minor(st1.st_rdev));
+ if (!quiet)
+ printf("%u:%u\n", dev_major(st1.st_rdev), dev_minor(st1.st_rdev));
return;
}
@@ -57,7 +58,7 @@ void mountpoint_main(void)
// absence of a spec I guess that's the expected behavior?
toys.exitval = !(st1.st_dev != st2.st_dev || st1.st_ino == st2.st_ino);
if (toys.optflags & FLAG_d)
- printf("%u:%u\n", major(st1.st_dev), minor(st1.st_dev));
+ printf("%u:%u\n", dev_major(st1.st_dev), dev_minor(st1.st_dev));
else if (!quiet)
printf("%s is %sa mountpoint\n", *toys.optargs, toys.exitval ? "not " : "");
}