[gnome-software] trivial: Do not create and then delete the flatpak symlink at startup
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Do not create and then delete the flatpak symlink at startup
- Date: Tue, 5 Jul 2016 09:57:31 +0000 (UTC)
commit f18ab26332ad82fe51ab35889dc2c9725908965c
Author: Richard Hughes <richard hughsie com>
Date: Tue Jul 5 10:56:53 2016 +0100
trivial: Do not create and then delete the flatpak symlink at startup
This should fix some race issues we spot when there are no remotes added.
src/plugins/gs-flatpak-symlinks.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/gs-flatpak-symlinks.c b/src/plugins/gs-flatpak-symlinks.c
index da1a82a..cff6c5a 100644
--- a/src/plugins/gs-flatpak-symlinks.c
+++ b/src/plugins/gs-flatpak-symlinks.c
@@ -113,13 +113,20 @@ gs_flatpak_symlinks_check_exist (FlatpakRemote *xremote,
return FALSE;
}
- /* create it if required */
+ /* create it if required, but only if the destination exists */
if (!g_file_test (symlink_source, G_FILE_TEST_EXISTS)) {
- g_debug ("creating missing symbolic link from %s to %s",
- symlink_source, symlink_target);
- if (!gs_utils_symlink (symlink_target, symlink_source, error))
- return FALSE;
+ if (g_file_test (symlink_target, G_FILE_TEST_EXISTS)) {
+ g_debug ("creating missing symbolic link from %s to %s",
+ symlink_source, symlink_target);
+ if (!gs_utils_symlink (symlink_target, symlink_source, error))
+ return FALSE;
+ } else {
+ g_debug ("not creating missing symbolic link from "
+ "%s to %s as target does not yet exist",
+ symlink_source, symlink_target);
+ }
}
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]