Skip to content

Commit 2a73b82

Browse files
committed
unixpwd: avoid double closing tmp descriptor on error
Signed-off-by: Sebastien Marie <[email protected]>
1 parent f5a1c50 commit 2a73b82

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

unixpwd/c/unixpwd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@ unixpwd_setspw(const char *user, char *password)
189189
fclose(spasswd_file);
190190
if (tmp_file)
191191
fclose(tmp_file);
192-
close(tmp);
192+
else
193+
close(tmp);
193194
unlink(tmp_name);
194195
return ENOLCK;
195196
}

0 commit comments

Comments
 (0)