index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2008-02-07 20:16:16 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-02-07 20:16:16 -0600 |
commit | bfc024eab3a1d26ba37620175be815cb2eb59606 (patch) | |
tree | 96c1c3d89b0e523364b6b000ef02105ebbd0923e /lib/libalpm/add.c | |
parent | 77c3cf9790472592902183354ea5481cffc01f58 (diff) | |
parent | 14ee1be1ef21e09a84f01dc9623e8513218709d4 (diff) |
-rw-r--r-- | lib/libalpm/add.c | 10 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 610cc25c..6c0a1eae 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -355,14 +355,12 @@ static int extract_single_file(struct archive *archive, * links, etc. * 12- skip extraction, dir already exists. */ - struct stat lsbuf; - if(_alpm_lstat(filename, &lsbuf) != 0) { + + /* do both a lstat and a stat, so we can see what symlinks point to */ + struct stat lsbuf, sbuf; + if(_alpm_lstat(filename, &lsbuf) != 0 || stat(filename, &sbuf) != 0) { /* cases 1,2,3: couldn't stat an existing file, skip all backup checks */ } else { - /* do a stat as well, so we can see what symlinks point to */ - struct stat sbuf; - stat(filename, &sbuf); - if(S_ISDIR(lsbuf.st_mode) && S_ISDIR(entrymode)) { /* case 12: existing dir, ignore it */ if(lsbuf.st_mode != entrymode) { |