aboutsummaryrefslogtreecommitdiff
path: root/loginutils/deluser.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-27 01:04:23 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-27 01:04:23 +0000
commita7b2c41e03555a9f7a7d44e80f65518b167fa280 (patch)
treeb7f8cacbdffafa2899b91fec52879c100ef02c72 /loginutils/deluser.c
parentc9bb67787a0d48af33045a2d813faf44ed5d59b4 (diff)
downloadbusybox-a7b2c41e03555a9f7a7d44e80f65518b167fa280.tar.gz
deluser: the same code, but a bit less obfuscated.
Diffstat (limited to 'loginutils/deluser.c')
-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)
}
}
- if (!found) {
- bb_error_msg("can't find '%s' in '%s'", login, filename);
- if (!ENABLE_FEATURE_CLEAN_UP) return;
- goto clean_up;
- }
-
- if (ENABLE_FEATURE_CLEAN_UP)
+ if (!ENABLE_FEATURE_CLEAN_UP) {
+ if (!found) {
+ bb_error_msg("can't find '%s' in '%s'", login, filename);
+ return;
+ }
+ passwd = fopen_or_warn(filename, "w");
+ if (passwd)
+ while ((line = llist_pop(&plist)))
+ fputs(line, passwd);
+ } else {
+ if (!found) {
+ bb_error_msg("can't find '%s' in '%s'", login, filename);
+ goto clean_up;
+ }
fclose(passwd);
-
- passwd = fopen_or_warn(filename, "w");
- if (passwd) {
- if (ENABLE_FEATURE_CLEAN_UP) {
+ passwd = fopen_or_warn(filename, "w");
+ if (passwd) {
clean_up:
while ((line = llist_pop(&plist))) {
if (found) fputs(line, passwd);
free(line);
}
fclose(passwd);
- } else {
- /* found != 0 here, no need to check */
- while ((line = llist_pop(&plist)))
- fputs(line, passwd);
}
}
}