void rawlog_save(RAWLOG_REC *rawlog, const char *fname) { char *path, *dir; int f; dir = g_path_get_dirname(fname); #ifdef HAVE_CAPSICUM capsicum_mkdir_with_parents_wrapper(dir, log_dir_create_mode); #else g_mkdir_with_parents(dir, log_dir_create_mode); #endif g_free(dir); path = convert_home(fname); #ifdef HAVE_CAPSICUM f = capsicum_open_wrapper(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); #else f = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); #endif g_free(path); if (f < 0) { g_warning("rawlog open() failed: %s", strerror(errno)); return; } rawlog_dump(rawlog, f); close(f); }
void rawlog_open(RAWLOG_REC *rawlog, const char *fname) { char *path; g_return_if_fail(rawlog != NULL); g_return_if_fail(fname != NULL); if (rawlog->logging) return; path = convert_home(fname); #ifdef HAVE_CAPSICUM rawlog->handle = capsicum_open_wrapper(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); #else rawlog->handle = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); #endif g_free(path); if (rawlog->handle == -1) { g_warning("rawlog open() failed: %s", strerror(errno)); return; } rawlog_dump(rawlog, rawlog->handle); rawlog->logging = TRUE; }
void rawlog_save(RAWLOG_REC *rawlog, const char *fname) { char *path; int f; path = convert_home(fname); f = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); g_free(path); rawlog_dump(rawlog, f); close(f); }
void rawlog_save(RAWLOG_REC *rawlog, const char *fname) { char *path, *dir; int f; dir = g_path_get_dirname(fname); mkpath(dir, log_dir_create_mode); g_free(dir); path = convert_home(fname); f = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); g_free(path); rawlog_dump(rawlog, f); close(f); }
void rawlog_open(RAWLOG_REC *rawlog, const char *fname) { char *path; g_return_if_fail(rawlog != NULL); g_return_if_fail(fname != NULL); if (rawlog->logging) return; path = convert_home(fname); rawlog->handle = open(path, O_WRONLY | O_APPEND | O_CREAT, log_file_create_mode); g_free(path); rawlog_dump(rawlog, rawlog->handle); rawlog->logging = rawlog->handle != -1; }