aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch')
-rw-r--r--recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch b/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch
new file mode 100644
index 0000000..424a3bd
--- /dev/null
+++ b/recipes-core/swupd-client/swupd-client-2.87/0001-log.c-avoid-segfault-and-show-staging-file-name.patch
@@ -0,0 +1,38 @@
+From 03ea6060f2992fffe242d0af769b7550a014c28f Mon Sep 17 00:00:00 2001
+From: Patrick Ohly <patrick.ohly@intel.com>
+Date: Thu, 14 Apr 2016 11:01:10 +0200
+Subject: [PATCH 1/2] log.c: avoid segfault and show staging file name
+
+When downloading files, "file->filename" is not set, only
+"file->staging" is. Now the code checks both, starting with
+"file->filename", and proceeds if both are unset, instead of
+segfaulting as before.
+
+Upstream-Status: Submitted [https://github.com/clearlinux/swupd-client/issues/37]
+
+Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
+---
+ src/log.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/src/log.c b/src/log.c
+index 5e5b030..0549f29 100644
+--- a/src/log.c
++++ b/src/log.c
+@@ -413,8 +413,11 @@ static char *format_log_message(int log_type, enum log_priority priority, struct
+ filebuf2[0] = 0;
+ strncpy(filebuf, filename, PATH_MAXLEN - 1);
+ if (file) {
+- strncpy(filebuf2, file->filename, PATH_MAXLEN - 1);
+- filebuf2[PATH_MAXLEN - 1] = 0;
++ const char *filename = file->filename ? file->filename : file->staging;
++ if (filename) {
++ strncpy(filebuf2, filename, PATH_MAXLEN - 1);
++ filebuf2[PATH_MAXLEN - 1] = 0;
++ }
+ }
+ while (strlen(filebuf) < 29)
+ strcat(filebuf, " ");
+--
+2.1.4
+