Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Feb 2012 05:03:04 +0000 (UTC)
From:      Garrett Wollman <wollman@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r231181 - head/usr.sbin/tzsetup
Message-ID:  <201202080503.q18534fK023276@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202080503.q18534fK023276>