Krolyxon
Commit 5c607ad

Branches

Refs →

nsxiv5c607ad

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.
Author
Bert Münnich
Date
2017-01-07 14:44 +0100
Parent
1c260e7
Commit
5c607ad4951e4313ecfd2bc42087d5550283880c

+3 −3

3 files changed

  1. M Makefile +1 −1
  2. M exec/key-handler +1 −1
  3. M main.c +1 −1
M Makefile View
@@ -1,4 +1,4 @@
1−VERSION := git-20161228
1+VERSION := git-20170107
22
33 PREFIX := /usr/local
44 MANPREFIX := $(PREFIX)/share/man
M exec/key-handler View
@@ -18,7 +18,7 @@ readonly TMPFILE="/tmp/sxiv.$$"
1818
1919 rotate() {
2020 degree="$1"
21− while read file; do
21+ tr '\n' \0' | xargs -0 realpath | sort | uniq | while read file; do
2222 case "$(file -b -i "$file")" in
2323 image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
2424 *) mogrify -rotate "$degree" "$file" ;;
M main.c View
@@ -525,7 +525,7 @@ void run_key_handler(const char *key, unsigned int mask)
525525 for (f = i = 0; f < fcnt; i++) {
526526 if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) {
527527 stat(files[i].path, &oldst[f]);
528− fprintf(pfs, "%s\n", files[i].path);
528+ fprintf(pfs, "%s\n", files[i].name);
529529 f++;
530530 }
531531 }