SOURCES: zsh-restore-histfile.patch (NEW) - new

arekm arekm at pld-linux.org
Fri Dec 16 09:24:05 CET 2005


Author: arekm                        Date: Fri Dec 16 08:24:05 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new

---- Files affected:
SOURCES:
   zsh-restore-histfile.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/zsh-restore-histfile.patch
diff -u /dev/null SOURCES/zsh-restore-histfile.patch:1.1
--- /dev/null	Fri Dec 16 09:24:05 2005
+++ SOURCES/zsh-restore-histfile.patch	Fri Dec 16 09:24:00 2005
@@ -0,0 +1,21 @@
+--- zsh.org/Src/hist.c.org	2005-12-16 10:51:24.680963000 +0100
++++ zsh/Src/hist.c	2005-12-16 10:59:14.100963000 +0100
+@@ -2127,8 +2127,18 @@
+ 	}
+ 	fclose(out);
+ 	if (tmpfile) {
++	    struct stat sb;
++	    int restore = 0;
++	    if (stat(unmeta(fn), &sb) == 0)
++		    restore = 1;
+ 	    if (rename(tmpfile, unmeta(fn)) < 0)
+ 		zerr("can't rename %s.new to $HISTFILE", fn, 0);
++	    else if (restore) {
++		    if (chown(unmeta(fn), sb.st_uid, sb.st_gid) < 0)
++			    zerr("can't restore user/group on $HISTFILE", 0);
++		    if (chmod(unmeta(fn), sb.st_mode) < 0)
++			    zerr("can't restore permissions on $HISTFILE", 0);
++	    }
+ 	    free(tmpfile);
+ 	}
+ 
================================================================



More information about the pld-cvs-commit mailing list