index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Chantry Xavier <shiningxc@gmail.com> | 2008-02-07 14:58:23 +0100 |
---|---|---|
committer | Chantry Xavier <shiningxc@gmail.com> | 2008-02-07 14:58:23 +0100 |
commit | 0c2206f542ce6df2606586d43f190cd5a423fb13 (patch) | |
tree | e771071518a2356c997c92fb41887e451b68797e | |
parent | b29838c8250125a22016c16180e941d059d55539 (diff) |
-rw-r--r-- | lib/libalpm/add.c | 10 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index ec49c2a3..eddf637e 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -361,14 +361,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) { |