core: Don't call unlink() on directory if it already exists

If we fail to make a directory because it exists, we shouldn't call
unlink() on it.
This commit is contained in:
Colin Walters 2012-03-06 11:33:42 -05:00
parent 1513f29495
commit 83fb6d56e1

View File

@ -839,8 +839,10 @@ ostree_create_file_from_input (GFile *dest_file,
ret = TRUE;
ot_transfer_out_value(out_checksum, &ret_checksum);
out:
if (!ret)
(void) unlink (dest_path);
if (!ret && !S_ISDIR(mode))
{
(void) unlink (dest_path);
}
ot_clear_checksum (&ret_checksum);
g_clear_object (&out);
return ret;