From 8dcc21ed8d70441050e90de7ab8582a337d411b2 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 28 Oct 2019 02:39:13 -0400 Subject: [PATCH] mkfs7: add uid function to handle -1 --- tools/mkfs7 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/mkfs7 b/tools/mkfs7 index a3a01d6..2cb166f 100755 --- a/tools/mkfs7 +++ b/tools/mkfs7 @@ -513,6 +513,12 @@ sub parse_perms { return ( $filetype, $perms ); } +sub uid { + my $uid = shift; + return 0777777 if ($uid eq '-1'); + return oct($uid); +} + # Open the named proto file and parse it sub parse_proto_file { my $file = shift; @@ -543,17 +549,17 @@ sub parse_proto_file { if ( $type eq I_DIRECTORY ) { my ( $name, $permstr, $uid, $inum ) = @words; - make_dir( $name, $perms, oct($uid), $inum ); + make_dir( $name, $perms, uid($uid), $inum ); next; } if ( $type eq I_FILE ) { my ( $name, $permstr, $uid, $extfile, $inum ) = @words; - add_file( $name, $perms, oct($uid), $extfile, $inum ); + add_file( $name, $perms, uid($uid), $extfile, $inum ); next; } if ( $type eq I_SPECIAL ) { my ( $name, $permstr, $uid, $inum ) = @words; - add_special( $name, $perms, oct($uid), $inum ); + add_special( $name, $perms, uid($uid), $inum ); next; } if ( $type eq I_LINK ) {