diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-27 01:04:23 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-27 01:04:23 +0000 |
commit | a7b2c41e03555a9f7a7d44e80f65518b167fa280 (patch) | |
tree | b7f8cacbdffafa2899b91fec52879c100ef02c72 | |
parent | c9bb67787a0d48af33045a2d813faf44ed5d59b4 (diff) | |
download | busybox-w32-a7b2c41e03555a9f7a7d44e80f65518b167fa280.tar.gz busybox-w32-a7b2c41e03555a9f7a7d44e80f65518b167fa280.tar.bz2 busybox-w32-a7b2c41e03555a9f7a7d44e80f65518b167fa280.zip |
deluser: the same code, but a bit less obfuscated.
-rw-r--r-- | loginutils/deluser.c | 31 |
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 | } |