[ostree] core: Don't call unlink() on directory if it already exists
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Don't call unlink() on directory if it already exists
- Date: Tue, 6 Mar 2012 17:02:02 +0000 (UTC)
commit 83fb6d56e1e57b20f0f1c24bcaa0d02abcb02cca
Author: Colin Walters <walters verbum org>
Date: Tue Mar 6 11:33:42 2012 -0500
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.
src/libostree/ostree-core.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/src/libostree/ostree-core.c b/src/libostree/ostree-core.c
index 3fe6d22..8a4cb1f 100644
--- a/src/libostree/ostree-core.c
+++ b/src/libostree/ostree-core.c
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]