Author: wollman
Date: Wed Feb  8 05:03:04 2012
New Revision: 231181
URL: http://svn.freebsd.org/changeset/base/231181

Log:
  It's not an error if unlink(2) fails because the pathname doesn't exist.
  
  Noticed by: kevlo
  Pointy hat to: wollman

Modified:
  head/usr.sbin/tzsetup/tzsetup.c

Modified: head/usr.sbin/tzsetup/tzsetup.c
==============================================================================
--- head/usr.sbin/tzsetup/tzsetup.c     Wed Feb  8 04:55:00 2012        
(r231180)
+++ head/usr.sbin/tzsetup/tzsetup.c     Wed Feb  8 05:03:04 2012        
(r231181)
@@ -723,7 +723,7 @@ install_zoneinfo_file(const char *zonein
                                return (DITEM_FAILURE | DITEM_RECREATE);
                        }
 
-                       if (unlink(path_localtime) < 0) {
+                       if (unlink(path_localtime) < 0 && errno != ENOENT) {
                                snprintf(prompt, sizeof(prompt),
                                    "Could not unlink %s: %s",
                                    path_localtime, strerror(errno));
@@ -780,7 +780,7 @@ install_zoneinfo_file(const char *zonein
                                        fprintf(stderr, "%s\n", prompt);
                                return (DITEM_FAILURE | DITEM_RECREATE);
                        }
-                       if (unlink(path_localtime) < 0) {
+                       if (unlink(path_localtime) < 0 && errno != ENOENT) {
                                snprintf(prompt, sizeof(prompt),
                                    "Could not unlink %s: %s",
                                    path_localtime, strerror(errno));
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to