瀏覽代碼

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.
master
Bert Münnich 8 年之前
父節點
當前提交
5c607ad495
共有 3 個檔案被更改,包括 3 行新增3 行删除
  1. +1
    -1
      Makefile
  2. +1
    -1
      exec/key-handler
  3. +1
    -1
      main.c

+ 1
- 1
Makefile 查看文件

@@ -1,4 +1,4 @@
VERSION := git-20161228 VERSION := git-20170107


PREFIX := /usr/local PREFIX := /usr/local
MANPREFIX := $(PREFIX)/share/man MANPREFIX := $(PREFIX)/share/man


+ 1
- 1
exec/key-handler 查看文件

@@ -18,7 +18,7 @@ readonly TMPFILE="/tmp/sxiv.$$"


rotate() { rotate() {
degree="$1" degree="$1"
while read file; do tr '\n' \0' | xargs -0 realpath | sort | uniq | while read file; do
case "$(file -b -i "$file")" in case "$(file -b -i "$file")" in
image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;; image/jpeg*) jpegtran -rotate "$degree" -copy all -outfile "$file" "$file" ;;
*) mogrify -rotate "$degree" "$file" ;; *) mogrify -rotate "$degree" "$file" ;;


+ 1
- 1
main.c 查看文件

@@ -525,7 +525,7 @@ void run_key_handler(const char *key, unsigned int mask)
for (f = i = 0; f < fcnt; i++) { for (f = i = 0; f < fcnt; i++) {
if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) { if ((marked && (files[i].flags & FF_MARK)) || (!marked && i == fileidx)) {
stat(files[i].path, &oldst[f]); stat(files[i].path, &oldst[f]);
fprintf(pfs, "%s\n", files[i].path); fprintf(pfs, "%s\n", files[i].name);
f++; f++;
} }
} }


||||||
x
 
000:0
Loading…
取消
儲存