diff options
author | Bert Münnich <ber.t@posteo.de> | 2017-01-07 14:44:33 +0100 |
---|---|---|
committer | Bert Münnich <ber.t@posteo.de> | 2017-01-07 14:44:33 +0100 |
commit | 5c607ad4951e4313ecfd2bc42087d5550283880c (patch) | |
tree | 417f0ff6a02dfb5d75cf839fcf62ed8559765a66 | |
parent | 1c260e701b30c95f1be02e5cd3291ebde2a529f4 (diff) |
Pass given file names to key-handler instead of real paths
Misbehaving command lines in the key-handler that rewrite the given files and
thus replace symbolic links instead of their targets shall call realpath(1).
Fixes issue #205 and reverts commit 92e3b578.
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | exec/key-handler | 2 | ||||
-rw-r--r-- | main.c | 2 |
3 files changed, 3 insertions, 3 deletions
@@ -1,4 +1,4 @@ -VERSION := git-20161228 +VERSION := git-20170107 PREFIX := /usr/local MANPREFIX := $(PREFIX)/share/man diff --git a/exec/key-handler b/exec/key-handler index 03d7499..439ab2e 100644 --- a/exec/key-handler +++ b/exec/key-handler @@ -18,7 +18,7 @@ readonly TMPFILE="/tmp/sxiv.$$" rotate() { degree="$1" - while read file; do + tr '\n' \0' | xargs -0 realpath | sort | uniq | while read file; do case "$(file -b -i "$file")" in image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;; *) mogrify -rotate "$degree" "$file" ;; @@ -525,7 +525,7 @@ void run_key_handler(const char *key, unsigned int mask) for (f = i = 0; f < fcnt; i++) { if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) { stat(files[i].path, &oldst[f]); - fprintf(pfs, "%s\n", files[i].path); + fprintf(pfs, "%s\n", files[i].name); f++; } } |