src/useradd.c: De-duplicate code

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar 2024-05-17 13:14:31 +02:00
parent 701fe4cf1a
commit a74c4b6ae1

View File

@ -571,14 +571,13 @@ static int set_defaults (void)
}
ret = mkdir(dirname(new_file_dup), 0755);
free(new_file_dup);
if (-1 == ret && EEXIST != errno) {
fprintf (stderr,
_("%s: cannot create directory for defaults file\n"),
Prog);
free(new_file_dup);
goto err_free_def;
}
free(new_file_dup);
/*
* Create a temporary file to copy the new output to.