659df2cda7
- Fix segfault without $XDG_CONFIG_HOME and $HOME set (bnc#768537, libiphone#273). (forwarded request 127502 from sbrabec) OBS-URL: https://build.opensuse.org/request/show/127522 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libimobiledevice?expand=0&rev=22
15 lines
494 B
Diff
15 lines
494 B
Diff
The patch fixes segfault when both $XDG_CONFIG_HOME and $HOME are unset
|
|
Signed-off-by: Maxim Mikityanskiy <maxtram95@gmail.com>
|
|
--- src/userpref.c.orig 2012-06-04 17:04:57.387303630 +0300
|
|
+++ src/userpref.c 2012-06-04 17:06:05.741301627 +0300
|
|
@@ -125,6 +125,9 @@
|
|
const char *cdir = getenv("XDG_CONFIG_HOME");
|
|
if (!cdir) {
|
|
cdir = getenv("HOME");
|
|
+ if (!cdir) {
|
|
+ cdir="/root";
|
|
+ }
|
|
strcpy(__config_dir, cdir);
|
|
strcat(__config_dir, DIR_SEP_S);
|
|
strcat(__config_dir, ".config");
|