mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-05 05:48:26 +02:00
33 lines
841 B
Diff
33 lines
841 B
Diff
|
--- busybox-1.00.old/loginutils/passwd.c 2004-09-15 04:39:09.000000000 +0200
|
||
|
+++ busybox-1.00/loginutils/passwd.c 2005-03-23 15:31:07.000000000 +0100
|
||
|
@@ -54,11 +54,12 @@
|
||
|
snprintf(filename, sizeof filename, "%s", bb_path_passwd_file);
|
||
|
}
|
||
|
|
||
|
- if (((fp = fopen(filename, "r+")) == 0) || (fstat(fileno(fp), &sb))) {
|
||
|
+ if (((fp = fopen(filename, "r")) == 0) || (fstat(fileno(fp), &sb))) {
|
||
|
/* return 0; */
|
||
|
return 1;
|
||
|
}
|
||
|
|
||
|
+#if 0
|
||
|
/* Lock the password file before updating */
|
||
|
lock.l_type = F_WRLCK;
|
||
|
lock.l_whence = SEEK_SET;
|
||
|
@@ -69,6 +70,7 @@
|
||
|
return 1;
|
||
|
}
|
||
|
lock.l_type = F_UNLCK;
|
||
|
+#endif
|
||
|
|
||
|
snprintf(buf, sizeof buf, "%s-", filename);
|
||
|
if (create_backup(buf, fp)) {
|
||
|
@@ -119,6 +121,7 @@
|
||
|
fclose(fp);
|
||
|
return 1;
|
||
|
}
|
||
|
+ unlink(filename);
|
||
|
if (rename(buf, filename) < 0) {
|
||
|
fcntl(fileno(fp), F_SETLK, &lock);
|
||
|
fclose(fp);
|