diff options
author | Cem Keylan <cem@ckyln.com> | 2021-07-17 15:26:55 +0300 |
---|---|---|
committer | Cem Keylan <cem@ckyln.com> | 2021-07-17 15:26:55 +0300 |
commit | 677e9bd281cd67b845c80e0e166fc767c4aecf7d (patch) | |
tree | bb21596339e0a784894c6857654b1ddf5e55366a /toys/posix | |
parent | d21b9d3c3147eb12f115b1fd361da913a1177fba (diff) | |
parent | 281f30dde58cc16229690a522a0db5b61802220f (diff) | |
download | toybox-master.tar.gz |
Diffstat (limited to 'toys/posix')
-rw-r--r-- | toys/posix/cpio.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/toys/posix/cpio.c b/toys/posix/cpio.c index 35b74b3b..5ecd56df 100644 --- a/toys/posix/cpio.c +++ b/toys/posix/cpio.c @@ -16,7 +16,7 @@ * * todo: export/import linux file list text format ala gen_initramfs_list.sh -USE_CPIO(NEWTOY(cpio, "(quiet)(no-preserve-owner)md(make-directories)uH:p|i|t|F:v(verbose)o|[!pio][!pot][!pF]", TOYFLAG_BIN)) +USE_CPIO(NEWTOY(cpio, "(ignore-devno)(renumber-inodes)(quiet)(no-preserve-owner)md(make-directories)uH:p|i|t|F:v(verbose)o|[!pio][!pot][!pF]", TOYFLAG_BIN)) config CPIO bool "cpio" @@ -243,6 +243,7 @@ void cpio_main(void) } else { char *name = 0; size_t size = 0; + unsigned inode = 0; for (;;) { struct stat st; @@ -269,6 +270,8 @@ void cpio_main(void) if (!S_ISREG(st.st_mode) && !S_ISLNK(st.st_mode)) st.st_size = 0; if (st.st_size >> 32) perror_msg("skipping >2G file '%s'", name); else { + if (FLAG(renumber_inodes)) st.st_ino = ++inode; + if (FLAG(ignore_devno)) st.st_rdev = 0; llen = sprintf(toybuf, "070701%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X%08X", (int)st.st_ino, st.st_mode, st.st_uid, st.st_gid, (int)st.st_nlink, |