diff options
Diffstat (limited to 'hugin.c')
-rw-r--r-- | hugin.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -232,8 +232,12 @@ hug_status_t hug_init(unsigned int flags, ...) hug_config.stdout_no_date = va_arg(vl, int); break; case HUG_OPTION_FILENAME: + { + const char *filename = (const char*) va_arg(vl, char*); + if(!filename) break; + if(hug_config.flags & HUG_FLAG_OUTPUT_TO_FILE) { - hug_config.filename = strdup((const char*)va_arg(vl, char*)); + hug_config.filename = strdup(filename); hug_config.file_fd = open(hug_config.filename, O_CREAT | O_APPEND | O_RDWR, 0777); if(hug_config.file_fd == -1) { @@ -242,6 +246,7 @@ hug_status_t hug_init(unsigned int flags, ...) return HUG_STATUS_ERROR; } } + } break; #ifdef WITH_HUG_SYSLOG case HUG_OPTION_SYSLOG_PORT: |