ypserv/ypserv-2.26-retval.patch
2011-11-28 12:25:15 +01:00

32 lines
1.3 KiB
Diff

diff -up ypserv-2.26/rpc.yppasswdd/update.c.retval ypserv-2.26/rpc.yppasswdd/update.c
--- ypserv-2.26/rpc.yppasswdd/update.c.retval 2011-10-19 16:27:10.292847501 +0200
+++ ypserv-2.26/rpc.yppasswdd/update.c 2011-10-19 16:29:01.983839864 +0200
@@ -720,7 +720,12 @@ update_files (yppasswd *yppw, char *logb
if (link (path_shadow, path_shadow_old) == -1)
log_msg ("Cannot create backup file %s: %s",
path_shadow_old, strerror (errno));
- rename (path_shadow_tmp, path_shadow);
+ if (rename (path_shadow_tmp, path_shadow) == -1)
+ {
+ log_msg ("Cannot move temporary file %s to %s: %s",
+ path_shadow_tmp, path_shadow, strerror (errno));
+ *shadow_changed = 0;
+ }
}
else
unlink (path_shadow_tmp);
@@ -732,7 +737,12 @@ update_files (yppasswd *yppw, char *logb
if (link (path_passwd, path_passwd_old) == -1)
log_msg ("Cannot create backup file %s: %s",
path_passwd_old, strerror (errno));
- rename (path_passwd_tmp, path_passwd);
+ if (rename (path_passwd_tmp, path_passwd) == -1)
+ {
+ log_msg ("Cannot move temporary file %s to %s: %s",
+ path_passwd_tmp, path_passwd, strerror (errno));
+ *passwd_changed = 0;
+ }
}
else
unlink (path_passwd_tmp);