[ostree] core: Skip an unnecessary unlink() call
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ostree] core: Skip an unnecessary unlink() call
- Date: Fri, 18 Nov 2011 14:57:27 +0000 (UTC)
commit 8621eb85b1fe7f92ec3f52db166f559541d19098
Author: Colin Walters <walters verbum org>
Date: Fri Nov 18 09:41:36 2011 -0500
core: Skip an unnecessary unlink() call
src/libostree/ostree-repo.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/libostree/ostree-repo.c b/src/libostree/ostree-repo.c
index d6c9ecd..1a1f10b 100644
--- a/src/libostree/ostree-repo.c
+++ b/src/libostree/ostree-repo.c
@@ -607,21 +607,23 @@ write_gvariant_to_tmp (OstreeRepo *self,
ot_util_set_error_from_errno (error, errno);
goto out;
}
+ g_free (tmp_name);
+ tmp_name = NULL;
ret = TRUE;
*out_tmpname = ot_gfile_new_for_path (dest_name);
*out_checksum = checksum;
checksum = NULL;
out:
- /* Unconditionally unlink; if we suceeded, there's a new link, if not, clean up. */
- (void) unlink (tmp_name);
+ if (tmp_name)
+ (void) unlink (tmp_name);
+ g_free (tmp_name);
if (fd != -1)
close (fd);
if (checksum)
g_checksum_free (checksum);
if (serialized != NULL)
g_variant_unref (serialized);
- g_free (tmp_name);
g_free (dest_name);
g_clear_object (&stream);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]