finally move buildroot-ng to trunk
[openwrt/staging/dedeckeh.git] / package / busybox / patches / 140-unlink-passwd.patch
1 --- busybox-1.00.old/loginutils/passwd.c 2004-09-15 04:39:09.000000000 +0200
2 +++ busybox-1.00/loginutils/passwd.c 2005-03-23 15:31:07.000000000 +0100
3 @@ -54,11 +54,12 @@
4 snprintf(filename, sizeof filename, "%s", bb_path_passwd_file);
5 }
6
7 - if (((fp = fopen(filename, "r+")) == 0) || (fstat(fileno(fp), &sb))) {
8 + if (((fp = fopen(filename, "r")) == 0) || (fstat(fileno(fp), &sb))) {
9 /* return 0; */
10 return 1;
11 }
12
13 +#if 0
14 /* Lock the password file before updating */
15 lock.l_type = F_WRLCK;
16 lock.l_whence = SEEK_SET;
17 @@ -69,6 +70,7 @@
18 return 1;
19 }
20 lock.l_type = F_UNLCK;
21 +#endif
22
23 snprintf(buf, sizeof buf, "%s-", filename);
24 if (create_backup(buf, fp)) {
25 @@ -119,6 +121,7 @@
26 fclose(fp);
27 return 1;
28 }
29 + unlink(filename);
30 if (rename(buf, filename) < 0) {
31 fcntl(fileno(fp), F_SETLK, &lock);
32 fclose(fp);