aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 4421b20..2c202b1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1140,8 +1140,16 @@ stat_to_cpio (struct cpio_file_stat *hdr, struct stat *st)
hdr->c_nlink = st->st_nlink;
hdr->c_uid = CPIO_UID (st->st_uid);
hdr->c_gid = CPIO_GID (st->st_gid);
- hdr->c_rdev_maj = major (st->st_rdev);
- hdr->c_rdev_min = minor (st->st_rdev);
+ if (S_ISBLK (st->st_mode) || S_ISCHR (st->st_mode))
+ {
+ hdr->c_rdev_maj = major (st->st_rdev);
+ hdr->c_rdev_min = minor (st->st_rdev);
+ }
+ else
+ {
+ hdr->c_rdev_maj = 0;
+ hdr->c_rdev_min = 0;
+ }
hdr->c_mtime = st->st_mtime;
hdr->c_filesize = st->st_size;
hdr->c_chksum = 0;

Return to:

Send suggestions and report system problems to the System administrator.