mirror of
https://github.com/sheumann/hush.git
synced 2025-01-31 03:34:10 +00:00
deluser: the same code, but a bit less obfuscated.
This commit is contained in:
parent
c9bb67787a
commit
a7b2c41e03
@ -34,28 +34,29 @@ static void del_line_matching(const char *login, const char *filename)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!ENABLE_FEATURE_CLEAN_UP) {
|
||||||
bb_error_msg("can't find '%s' in '%s'", login, filename);
|
if (!found) {
|
||||||
if (!ENABLE_FEATURE_CLEAN_UP) return;
|
bb_error_msg("can't find '%s' in '%s'", login, filename);
|
||||||
goto clean_up;
|
return;
|
||||||
}
|
}
|
||||||
|
passwd = fopen_or_warn(filename, "w");
|
||||||
if (ENABLE_FEATURE_CLEAN_UP)
|
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);
|
fclose(passwd);
|
||||||
|
passwd = fopen_or_warn(filename, "w");
|
||||||
passwd = fopen_or_warn(filename, "w");
|
if (passwd) {
|
||||||
if (passwd) {
|
|
||||||
if (ENABLE_FEATURE_CLEAN_UP) {
|
|
||||||
clean_up:
|
clean_up:
|
||||||
while ((line = llist_pop(&plist))) {
|
while ((line = llist_pop(&plist))) {
|
||||||
if (found) fputs(line, passwd);
|
if (found) fputs(line, passwd);
|
||||||
free(line);
|
free(line);
|
||||||
}
|
}
|
||||||
fclose(passwd);
|
fclose(passwd);
|
||||||
} else {
|
|
||||||
/* found != 0 here, no need to check */
|
|
||||||
while ((line = llist_pop(&plist)))
|
|
||||||
fputs(line, passwd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user