From 31a29e452b7f830e05bee712e093836a1af87b89 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sat, 12 Nov 2016 11:36:39 +0100 Subject: [PATCH] Fix #497: Create user runtime dir if not exists. --- source/rofi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/rofi.c b/source/rofi.c index b5d89615..ee1fa8cb 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -676,6 +676,10 @@ int main ( int argc, char *argv[] ) // Create pid file path. const char *path = g_get_user_runtime_dir (); if ( path ) { + if ( g_mkdir_with_parents ( path, 0700 ) < 0 ) { + fprintf ( stderr, "Failed to create user runtime directory: %s\n", strerror ( errno ) ); + return EXIT_FAILURE; + } pidfile = g_build_filename ( path, "rofi.pid", NULL ); } config_parser_add_option ( xrm_String, "pid", (void * *) &pidfile, "Pidfile location" );