aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--loginutils/deluser.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index e33710175..869b22013 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -34,28 +34,29 @@ static void del_line_matching(const char *login, const char *filename)
34 } 34 }
35 } 35 }
36 36
37 if (!found) { 37 if (!ENABLE_FEATURE_CLEAN_UP) {
38 bb_error_msg("can't find '%s' in '%s'", login, filename); 38 if (!found) {
39 if (!ENABLE_FEATURE_CLEAN_UP) return; 39 bb_error_msg("can't find '%s' in '%s'", login, filename);
40 goto clean_up; 40 return;
41 } 41 }
42 42 passwd = fopen_or_warn(filename, "w");
43 if (ENABLE_FEATURE_CLEAN_UP) 43 if (passwd)
44 while ((line = llist_pop(&plist)))
45 fputs(line, passwd);
46 } else {
47 if (!found) {
48 bb_error_msg("can't find '%s' in '%s'", login, filename);
49 goto clean_up;
50 }
44 fclose(passwd); 51 fclose(passwd);
45 52 passwd = fopen_or_warn(filename, "w");
46 passwd = fopen_or_warn(filename, "w"); 53 if (passwd) {
47 if (passwd) {
48 if (ENABLE_FEATURE_CLEAN_UP) {
49 clean_up: 54 clean_up:
50 while ((line = llist_pop(&plist))) { 55 while ((line = llist_pop(&plist))) {
51 if (found) fputs(line, passwd); 56 if (found) fputs(line, passwd);
52 free(line); 57 free(line);
53 } 58 }
54 fclose(passwd); 59 fclose(passwd);
55 } else {
56 /* found != 0 here, no need to check */
57 while ((line = llist_pop(&plist)))
58 fputs(line, passwd);
59 } 60 }
60 } 61 }
61} 62}