aboutsummaryrefslogtreecommitdiff
path: root/src/imv.c
diff options
context:
space:
mode:
authorÉrico Rolim <erico.erc@gmail.com>2020-10-22 03:47:15 -0300
committerHarry Jeffery <harry@exec64.co.uk>2020-11-16 22:12:07 +0000
commit489421b9e763865881df614a3ef550b289409677 (patch)
treef67345f16496d194d299fba3de5a41489a932eec /src/imv.c
parent6cb2b8495f0da310acf8779db47a3317e9c54707 (diff)
downloadimv-489421b9e763865881df614a3ef550b289409677.tar.gz
imv, ipc: improve error checking for ipc creation.
Since this isn't essential functionality, it's ok to simply not provide it. In cases where XDG_RUNTIME_DIR was empty (but not unset) or set to a directory where the user didn't have write permissions, socket creation would fail and lead to segmentation faults in imv, due to the return value of imv_ipc_create() not being checked.
Diffstat (limited to 'src/imv.c')
-rw-r--r--src/imv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/imv.c b/src/imv.c
index 2a78012..34bfc54 100644
--- a/src/imv.c
+++ b/src/imv.c
@@ -533,7 +533,9 @@ struct imv *imv_create(void)
imv->console = imv_console_create();
imv_console_set_command_callback(imv->console, &command_callback, imv);
imv->ipc = imv_ipc_create();
- imv_ipc_set_command_callback(imv->ipc, &command_callback, imv);
+ if (imv->ipc) {
+ imv_ipc_set_command_callback(imv->ipc, &command_callback, imv);
+ }
imv->title_text = strdup(
"imv - [${imv_current_index}/${imv_file_count}]"
" [${imv_width}x${imv_height}] [${imv_scale}%]"