(wrong string) ünnich

From: <git_AT_suckless.org>
Date: Sat, 7 Jan 2017 14:49:48 +0100 (CET)

commit 5c607ad4951e4313ecfd2bc42087d5550283880c
Author: Bert Münnich <ber.t_AT_posteo.de>
AuthorDate: Sat Jan 7 14:44:33 2017 +0100
Commit: Bert Münnich <ber.t_AT_posteo.de>
CommitDate: Sat Jan 7 14:44:33 2017 +0100

    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.

diff --git a/Makefile b/Makefile
index 3d7834e..84d1ce2 100644
--- a/Makefile
+++ b/Makefile
_AT_@ -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
_AT_@ -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" ;;
diff --git a/main.c b/main.c
index 8f61ee7..f1ac14a 100644
--- a/main.c
+++ b/main.c
_AT_@ -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++;
                 }
         }
Received on Sat Jan 07 2017 - 14:49:48 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 07 2017 - 15:00:18 CET