summaryrefslogtreecommitdiffstats
path: root/usr.bin/gzip/gzip.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2011-05-23 09:40:21 +0000
committerdelphij <delphij@FreeBSD.org>2011-05-23 09:40:21 +0000
commitc7822ff2b13b979d341e0870a19099ab66e168ba (patch)
tree1647df00a65a93608603382a71314a1477b63354 /usr.bin/gzip/gzip.c
parentf71ef98f21035641932d7e1aa2311e27af0fd5eb (diff)
downloadFreeBSD-src-c7822ff2b13b979d341e0870a19099ab66e168ba.zip
FreeBSD-src-c7822ff2b13b979d341e0870a19099ab66e168ba.tar.gz
Match symbolic link handling behavior with GNU gzip, bzip2 and xz:
When we are operating on a symbolic link pointing to an existing file, bail out by default, but go ahead if -f is specified. Submitted by: arundel MFC after: 2 weeks
Diffstat (limited to 'usr.bin/gzip/gzip.c')
-rw-r--r--usr.bin/gzip/gzip.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/gzip/gzip.c b/usr.bin/gzip/gzip.c
index 474575c..927493e 100644
--- a/usr.bin/gzip/gzip.c
+++ b/usr.bin/gzip/gzip.c
@@ -1782,7 +1782,7 @@ handle_pathname(char *path)
}
retry:
- if (stat(path, &sb) != 0) {
+ if (stat(path, &sb) != 0 || (fflag == 0 && lstat(path, &sb) != 0)) {
/* lets try <path>.gz if we're decompressing */
if (dflag && s == NULL && errno == ENOENT) {
len = strlen(path);
OpenPOWER on IntegriCloud