Add trap to remove lockfiles on exit.
authorJameson Graef Rollins <jrollins@phys.columbia.edu>
Mon, 23 Jun 2008 22:53:20 +0000 (18:53 -0400)
committerJameson Graef Rollins <jrollins@phys.columbia.edu>
Mon, 23 Jun 2008 22:53:20 +0000 (18:53 -0400)
src/common

index 9dcc5e869986188cb58b4eef491f93aac1f9e3a7..1908022eb947a50681082c274456a8e10bce47ab 100644 (file)
@@ -445,6 +445,9 @@ update_known_hosts() {
     # least one host
     returnCode=0
 
+    # set the trap to remove any lockfiles on exit
+    trap "lockfile-remove $KNOWN_HOSTS" EXIT
+
     # create a lockfile on known_hosts
     lockfile-create "$KNOWN_HOSTS"
 
@@ -526,6 +529,9 @@ update_authorized_keys() {
     # at least one user ID
     returnCode=0
 
+    # set the trap to remove any lockfiles on exit
+    trap "lockfile-remove $AUTHORIZED_KEYS" EXIT
+
     # create a lockfile on authorized_keys
     lockfile-create "$AUTHORIZED_KEYS"