diff options
author | Rob Landley <rob@landley.net> | 2016-03-02 11:52:38 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2016-03-02 11:52:38 -0600 |
commit | 7ca5dc4232b9ac5ee5cd25c8b5b33a58904cd251 (patch) | |
tree | 258fe0d485c5793e19a56be81f9d71e51476f0d8 /toys/pending | |
parent | 323819c689448fffcf4d3ed20f2485b75ac64b64 (diff) | |
download | toybox-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/pending')
-rw-r--r-- | toys/pending/mdev.c | 2 | ||||
-rw-r--r-- | toys/pending/tar.c | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/toys/pending/mdev.c b/toys/pending/mdev.c index e7adc993..975d31da 100644 --- a/toys/pending/mdev.c +++ b/toys/pending/mdev.c @@ -190,7 +190,7 @@ found_device: if (strchr(device_name, '/')) mkpathat(AT_FDCWD, toybuf, 0, 2); - if (mknod(toybuf, mode | type, makedev(major, minor)) && errno != EEXIST) + if (mknod(toybuf, mode | type, dev_makedev(major, minor)) && errno != EEXIST) perror_exit("mknod %s failed", toybuf); diff --git a/toys/pending/tar.c b/toys/pending/tar.c index 4f4de0b5..c5043087 100644 --- a/toys/pending/tar.c +++ b/toys/pending/tar.c @@ -228,8 +228,8 @@ static void add_file(struct archive_handler *tar, char **nam, struct stat *st) else if (S_ISFIFO(st->st_mode)) hdr.type = '6'; else if (S_ISBLK(st->st_mode) || S_ISCHR(st->st_mode)) { hdr.type = (S_ISCHR(st->st_mode))?'3':'4'; - itoo(hdr.major, sizeof(hdr.major), major(st->st_rdev)); - itoo(hdr.minor, sizeof(hdr.minor), minor(st->st_rdev)); + itoo(hdr.major, sizeof(hdr.major), dev_major(st->st_rdev)); + itoo(hdr.minor, sizeof(hdr.minor), dev_minor(st->st_rdev)); } else { error_msg("unknown file type '%o'", st->st_mode & S_IFMT); return; @@ -623,7 +623,7 @@ CHECK_MAGIC: file_hdr->gname = xstrdup(tar.gname); maj = otoi(tar.major, sizeof(tar.major)); min = otoi(tar.minor, sizeof(tar.minor)); - file_hdr->device = makedev(maj, min); + file_hdr->device = dev_makedev(maj, min); if (tar.type <= '7') { if (tar.link[0]) { |