[svn] GnuPG - r5237 - trunk/tools

svn author wk cvs at cvs.gnupg.org
Fri Dec 18 17:26:50 CET 2009


Author: wk
Date: 2009-12-18 17:26:50 +0100 (Fri, 18 Dec 2009)
New Revision: 5237

Modified:
   trunk/tools/ChangeLog
   trunk/tools/applygnupgdefaults
Log:
Fix bug 1146


Modified: trunk/tools/ChangeLog
===================================================================
--- trunk/tools/ChangeLog	2009-12-17 17:56:17 UTC (rev 5236)
+++ trunk/tools/ChangeLog	2009-12-18 16:26:50 UTC (rev 5237)
@@ -1,3 +1,7 @@
+2009-12-18  Werner Koch  <wk at g10code.com>
+
+	* applygnupgdefaults (errorfile): Use mktemp.  Fixes bug#1146.
+
 2009-12-08  Marcus Brinkmann  <marcus at g10code.de>
 
 	* gpg-connect-agent.c (main): Convert posix fd to assuan fd.

Modified: trunk/tools/applygnupgdefaults
===================================================================
--- trunk/tools/applygnupgdefaults	2009-12-17 17:56:17 UTC (rev 5236)
+++ trunk/tools/applygnupgdefaults	2009-12-18 16:26:50 UTC (rev 5237)
@@ -1,5 +1,5 @@
 #!/bin/sh                                               
-# Apply defaults from/etc/gnupg/gpg.conf to all users             -*- sh -*-
+# Apply defaults from /etc/gnupg/gpg.conf to all users             -*- sh -*-
 #
 # Copyright 2007 Free Software Foundation, Inc.
 #
@@ -16,7 +16,7 @@
 
 error () {
   echo "$PGM: $*" >&2
-  echo "$PGM: $*" >>$errorfile
+  [ -n "$errorfile" ] && echo "$PGM: $*" >>$errorfile
 }
 
 info () {
@@ -34,10 +34,9 @@
     [ -n "$errorfile" -a -f "$errorfile" ] && rm "$errorfile"
 }
 trap cleanup EXIT SIGINT SIGHUP SIGPIPE
-errorfile="/tmp/$PGM.$$.log"
-: >$errorfile
+errorfile=$(mktemp "/tmp/$PGM.log.XXXXXX")
+[ -n "$errorfile" -a -f "$errorfile" ] || exit 2
 
-
 # Check whether we can use getent
 if getent --help </dev/null >/dev/null 2>&1 ; then
     cat_passwd='getent passwd'
@@ -62,7 +61,7 @@
 
 ${cat_passwd} \
   | while IFS=: read -r user dmy_a uid dmy_c dmy_d home shell dmy_rest; do
-    # Process only entires with a valid login shell
+    # Process only entries with a valid login shell
     grep </etc/shells "^$shell" 2>/dev/null >/dev/null || continue
     # and with an existant gnupg home directory
     [ -d "$home/.gnupg" ] || continue




More information about the Gnupg-commits mailing list