diff options
author | Steven Mestdagh <steven@cvs.openbsd.org> | 2006-12-05 14:04:20 +0000 |
---|---|---|
committer | Steven Mestdagh <steven@cvs.openbsd.org> | 2006-12-05 14:04:20 +0000 |
commit | 316ece1c8ec7185461db649ef3123e245fc5eda7 (patch) | |
tree | 08dbeaaa08894032094560fb928433902998bcf1 /usr.sbin/pkg_add/OpenBSD | |
parent | 4cdecefde507289aa741275a8589919cdc17af2a (diff) |
use lstat for symbolic links; fixes uninitialized uid/gid.
ok espie@
Diffstat (limited to 'usr.sbin/pkg_add/OpenBSD')
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 8450ed3f3e3..431736cbb8f 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.48 2006/02/16 11:21:58 espie Exp $ +# $OpenBSD: Add.pm,v 1.49 2006/12/05 14:04:19 steven Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -140,7 +140,12 @@ sub set_modes $uidcache = OpenBSD::UidCache->new(); $gidcache = OpenBSD::GidCache->new(); } - my ($uid, $gid) = (stat $name)[4,5]; + my ($uid, $gid); + if (-l $name) { + ($uid, $gid) = (lstat $name)[4,5]; + } else { + ($uid, $gid) = (stat $name)[4,5]; + } if (defined $self->{owner}) { $uid = $uidcache->lookup($self->{owner}, $uid); } |