From e9f1696cb992030aeeb545526d043b4ab6c8658e Mon Sep 17 00:00:00 2001 From: Michael Vrable Date: Tue, 15 May 2007 15:57:24 -0700 Subject: [PATCH] Handle new-style user/group entries in the restore script. The new style is uid (username) and was previously causing a warning since the entire string is not numeric, just the first part. Now explicitly split it apart. (For now, we ignore the username string, but it could possibly be used in the future.) --- restore.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/restore.pl b/restore.pl index be94078..c7b4cca 100755 --- a/restore.pl +++ b/restore.pl @@ -272,8 +272,14 @@ sub process_file { my $uid = -1; my $gid = -1; - $uid = $info{user} + 0 if defined $info{user}; - $gid = $info{group} + 0 if defined $info{group}; + if (defined $info{user}) { + my @items = split /\s/, $info{user}; + $uid = $items[0] + 0 if exists $items[0]; + } + if (defined $info{group}) { + my @items = split /\s/, $info{group}; + $gid = $items[0] + 0 if exists $items[0]; + } chown $uid, $gid, $dest or warn "Unable to change ownership for $dest"; -- 2.20.1