It's not an error if unlink(2) fails because the pathname doesn't exist.

Noticed by: kevlo
Pointy hat to: wollman
This commit is contained in:
Garrett Wollman 2012-02-08 05:03:04 +00:00
parent 2cb3783b57
commit 41b549dc80
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=231181

View File

@ -723,7 +723,7 @@ install_zoneinfo_file(const char *zoneinfo_file)
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 *zoneinfo_file)
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));