diff options
author | Denys Vlasenko <dvlasenk@redhat.com> | 2011-02-28 17:23:50 +0100 |
---|---|---|
committer | Denys Vlasenko <dvlasenk@redhat.com> | 2011-02-28 17:23:50 +0100 |
commit | 3a6d12fcd182c0de13800fe463482d6a4408f885 (patch) | |
tree | 3d671b74163719dcc1ccdef644b06abc6dfdd538 /src | |
parent | 39ce00f37c753ae7830a8f33631de468a0ec8212 (diff) | |
download | abrt-3a6d12fcd182c0de13800fe463482d6a4408f885.tar.gz abrt-3a6d12fcd182c0de13800fe463482d6a4408f885.tar.xz abrt-3a6d12fcd182c0de13800fe463482d6a4408f885.zip |
dump_dir API: rename dd_dir field to dd_dirname
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/applet/test_report.c | 2 | ||||
-rw-r--r-- | src/cli/CLI.cpp | 2 | ||||
-rw-r--r-- | src/gui-gtk/abrt-gtk.c | 2 | ||||
-rw-r--r-- | src/gui-wizard-gtk/wizard.c | 2 | ||||
-rw-r--r-- | src/hooks/abrt-hook-ccpp.c | 2 | ||||
-rw-r--r-- | src/include/report/dump_dir.h | 4 | ||||
-rw-r--r-- | src/lib/dump_dir.c | 42 | ||||
-rw-r--r-- | src/lib/run_event.c | 2 | ||||
-rw-r--r-- | src/lib/steal_directory.c | 4 | ||||
-rw-r--r-- | src/report-python/dump_dir.c | 10 |
10 files changed, 36 insertions, 36 deletions
diff --git a/src/applet/test_report.c b/src/applet/test_report.c index dada106e..f5e79d92 100644 --- a/src/applet/test_report.c +++ b/src/applet/test_report.c @@ -43,7 +43,7 @@ int main(int argc, char** argv) free_crash_data(crash_data); if (!dd) return 1; - char *dir_name = strdup(dd->dd_dir); + char *dir_name = strdup(dd->dd_dirname); dd_close(dd); printf("Temp dump dir: '%s'\n", dir_name); diff --git a/src/cli/CLI.cpp b/src/cli/CLI.cpp index 593ed6ee..5ece3171 100644 --- a/src/cli/CLI.cpp +++ b/src/cli/CLI.cpp @@ -396,7 +396,7 @@ int main(int argc, char** argv) if (dd_copy) { delete_dump_dir_possibly_using_abrtd(dump_dir_name); - dump_dir_name = xstrdup(dd_copy->dd_dir); + dump_dir_name = xstrdup(dd_copy->dd_dirname); dd_close(dd_copy); } } diff --git a/src/gui-gtk/abrt-gtk.c b/src/gui-gtk/abrt-gtk.c index ae21fa30..fc945d76 100644 --- a/src/gui-gtk/abrt-gtk.c +++ b/src/gui-gtk/abrt-gtk.c @@ -43,7 +43,7 @@ void add_directory_to_dirlist(const char *dirname) gtk_list_store_set(s_dumps_list_store, &iter, COLUMN_REPORTED, reported, COLUMN_REASON, reason, - COLUMN_DIRNAME, dd->dd_dir, + COLUMN_DIRNAME, dd->dd_dirname, //OPTION: time format COLUMN_LATEST_CRASH_STR, time_buf, COLUMN_LATEST_CRASH, (int)time, diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index f0e83817..886bdf73 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -161,7 +161,7 @@ struct dump_dir *steal_if_needed(struct dump_dir *dd) * therefore it's a bit more complicated. */ char *old_name = g_dump_dir_name; - g_dump_dir_name = xstrdup(dd->dd_dir); + g_dump_dir_name = xstrdup(dd->dd_dirname); dd_close(dd); gtk_window_set_title(GTK_WINDOW(g_assistant), g_dump_dir_name); diff --git a/src/hooks/abrt-hook-ccpp.c b/src/hooks/abrt-hook-ccpp.c index ac8f90ee..46d96c91 100644 --- a/src/hooks/abrt-hook-ccpp.c +++ b/src/hooks/abrt-hook-ccpp.c @@ -502,7 +502,7 @@ int main(int argc, char** argv) char source_filename[sizeof("/proc/%lu/smaps") + sizeof(long)*3]; int base_name = sprintf(source_filename, "/proc/%lu/smaps", (long)pid); base_name -= strlen("smaps"); - char *dest_filename = concat_path_file(dd->dd_dir, FILENAME_SMAPS); + char *dest_filename = concat_path_file(dd->dd_dirname, FILENAME_SMAPS); copy_file(source_filename, dest_filename, S_IRUSR | S_IRGRP | S_IWUSR); chown(dest_filename, dd->dd_uid, dd->dd_gid); strcpy(source_filename + base_name, "maps"); diff --git a/src/include/report/dump_dir.h b/src/include/report/dump_dir.h index 66b61054..1376d7f3 100644 --- a/src/include/report/dump_dir.h +++ b/src/include/report/dump_dir.h @@ -35,7 +35,7 @@ enum { }; struct dump_dir { - char *dd_dir; + char *dd_dirname; DIR *next_dir; int locked; uid_t dd_uid; @@ -65,7 +65,7 @@ void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, uns /* Returns 0 if directory is deleted or not found */ int dd_delete(struct dump_dir *dd); -void delete_dump_dir(const char *dd_dir); +void delete_dump_dir(const char *dirname); #ifdef __cplusplus } diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c index 3ba2f059..a84e2814 100644 --- a/src/lib/dump_dir.c +++ b/src/lib/dump_dir.c @@ -172,14 +172,14 @@ static int get_and_set_lock(const char* lock_file, const char* pid) static int dd_lock(struct dump_dir *dd, unsigned sleep_usec) { if (dd->locked) - error_msg_and_die("Locking bug on '%s'", dd->dd_dir); + error_msg_and_die("Locking bug on '%s'", dd->dd_dirname); char pid_buf[sizeof(long)*3 + 2]; sprintf(pid_buf, "%lu", (long)getpid()); - unsigned dirname_len = strlen(dd->dd_dir); + unsigned dirname_len = strlen(dd->dd_dirname); char lock_buf[dirname_len + sizeof("/.lock")]; - strcpy(lock_buf, dd->dd_dir); + strcpy(lock_buf, dd->dd_dirname); strcpy(lock_buf + dirname_len, "/.lock"); unsigned count = NO_TIME_FILE_COUNT; @@ -229,9 +229,9 @@ static void dd_unlock(struct dump_dir *dd) { dd->locked = 0; - unsigned dirname_len = strlen(dd->dd_dir); + unsigned dirname_len = strlen(dd->dd_dirname); char lock_buf[dirname_len + sizeof("/.lock")]; - strcpy(lock_buf, dd->dd_dir); + strcpy(lock_buf, dd->dd_dirname); strcpy(lock_buf + dirname_len, "/.lock"); xunlink(lock_buf); @@ -246,7 +246,7 @@ static inline struct dump_dir *dd_init(void) int dd_exist(struct dump_dir *dd, const char *path) { - char *full_path = concat_path_file(dd->dd_dir, path); + char *full_path = concat_path_file(dd->dd_dirname, path); int ret = exist_file_dir(full_path); free(full_path); return ret; @@ -264,7 +264,7 @@ void dd_close(struct dump_dir *dd) /* free(dd->next_dir); - WRONG! */ } - free(dd->dd_dir); + free(dd->dd_dirname); free(dd); } @@ -280,7 +280,7 @@ struct dump_dir *dd_opendir(const char *dir, int flags) { struct dump_dir *dd = dd_init(); - dir = dd->dd_dir = rm_trailing_slashes(dir); + dir = dd->dd_dirname = rm_trailing_slashes(dir); errno = 0; if (dd_lock(dd, WAIT_FOR_OTHER_PROCESS_USLEEP) < 0) @@ -374,7 +374,7 @@ struct dump_dir *dd_create(const char *dir, uid_t uid) * realpath will always return NULL. We don't really have to: * dd_opendir(".") makes sense, dd_create(".") does not. */ - dir = dd->dd_dir = rm_trailing_slashes(dir); + dir = dd->dd_dirname = rm_trailing_slashes(dir); const char *last_component = strrchr(dir, '/'); if (last_component) @@ -402,11 +402,11 @@ struct dump_dir *dd_create(const char *dir, uid_t uid) int err = errno; if (!created_parents && errno == ENOENT) { - char *p = dd->dd_dir + 1; + char *p = dd->dd_dirname + 1; while ((p = strchr(p, '/')) != NULL) { *p = '\0'; - int r = (mkdir(dd->dd_dir, 0755) == 0 || errno == EEXIST); + int r = (mkdir(dd->dd_dirname, 0755) == 0 || errno == EEXIST); *p++ = '/'; if (!r) goto report_err; @@ -574,7 +574,7 @@ static int delete_file_dir(const char *dir, bool skip_lock_file) int dd_delete(struct dump_dir *dd) { - int r = delete_file_dir(dd->dd_dir, /*skip_lock_file:*/ true); + int r = delete_file_dir(dd->dd_dirname, /*skip_lock_file:*/ true); dd->locked = 0; /* delete_file_dir already removed .lock */ dd_close(dd); return r; @@ -653,7 +653,7 @@ char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned fla if (strcmp(name, "release") == 0) name = FILENAME_OS_RELEASE; - char *full_path = concat_path_file(dd->dd_dir, name); + char *full_path = concat_path_file(dd->dd_dirname, name); char *ret = load_text_file(full_path, flags); free(full_path); @@ -670,7 +670,7 @@ void dd_save_text(struct dump_dir *dd, const char *name, const char *data) if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ - char *full_path = concat_path_file(dd->dd_dir, name); + char *full_path = concat_path_file(dd->dd_dirname, name); save_binary_file(full_path, data, strlen(data), dd->dd_uid, dd->dd_gid); free(full_path); } @@ -680,7 +680,7 @@ void dd_save_binary(struct dump_dir* dd, const char* name, const char* data, uns if (!dd->locked) error_msg_and_die("dump_dir is not opened"); /* bug */ - char *full_path = concat_path_file(dd->dd_dir, name); + char *full_path = concat_path_file(dd->dd_dirname, name); save_binary_file(full_path, data, size, dd->dd_uid, dd->dd_gid); free(full_path); } @@ -693,10 +693,10 @@ DIR *dd_init_next_file(struct dump_dir *dd) if (dd->next_dir) closedir(dd->next_dir); - dd->next_dir = opendir(dd->dd_dir); + dd->next_dir = opendir(dd->dd_dirname); if (!dd->next_dir) { - error_msg("Can't open directory '%s'", dd->dd_dir); + error_msg("Can't open directory '%s'", dd->dd_dirname); } return dd->next_dir; @@ -710,12 +710,12 @@ int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name) struct dirent *dent; while ((dent = readdir(dd->next_dir)) != NULL) { - if (is_regular_file(dent, dd->dd_dir)) + if (is_regular_file(dent, dd->dd_dirname)) { if (short_name) *short_name = xstrdup(dent->d_name); if (full_name) - *full_name = concat_path_file(dd->dd_dir, dent->d_name); + *full_name = concat_path_file(dd->dd_dirname, dent->d_name); return 1; } } @@ -726,9 +726,9 @@ int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name) } /* Utility function */ -void delete_dump_dir(const char *dd_dir) +void delete_dump_dir(const char *dirname) { - struct dump_dir *dd = dd_opendir(dd_dir, /*flags:*/ 0); + struct dump_dir *dd = dd_opendir(dirname, /*flags:*/ 0); if (dd) { dd_delete(dd); diff --git a/src/lib/run_event.c b/src/lib/run_event.c index 91ca68f0..e96e762f 100644 --- a/src/lib/run_event.c +++ b/src/lib/run_event.c @@ -336,7 +336,7 @@ int run_event_on_crash_data(struct run_event_state *state, crash_data_t *data, c struct dump_dir *dd = create_dump_dir_from_crash_data(data, NULL); if (!dd) return -1; - char *dir_name = xstrdup(dd->dd_dir); + char *dir_name = xstrdup(dd->dd_dirname); dd_close(dd); int r = run_event_on_dir_name(state, dir_name, event); diff --git a/src/lib/steal_directory.c b/src/lib/steal_directory.c index 67c76c25..a77861ee 100644 --- a/src/lib/steal_directory.c +++ b/src/lib/steal_directory.c @@ -27,8 +27,8 @@ struct dump_dir *steal_directory(const char *base_dir, const char *dump_dir_name dst_dir_name = xasprintf("%s/%s.%u", base_dir, base_name, (int)tv.tv_usec); } - VERB1 log("Creating copy in '%s'", dd_dst->dd_dir); - if (copy_file_recursive(dump_dir_name, dd_dst->dd_dir) < 0) + VERB1 log("Creating copy in '%s'", dd_dst->dd_dirname); + if (copy_file_recursive(dump_dir_name, dd_dst->dd_dirname) < 0) { /* error. copy_file_recursive already emitted error message */ /* Don't leave half-copied dir lying around */ diff --git a/src/report-python/dump_dir.c b/src/report-python/dump_dir.c index 067b905b..c8ff3798 100644 --- a/src/report-python/dump_dir.c +++ b/src/report-python/dump_dir.c @@ -167,7 +167,7 @@ static PyObject *get_name(PyObject *pself, void *unused) { p_dump_dir *self = (p_dump_dir*)pself; if (self->dd) - return Py_BuildValue("s", self->dd->dd_dir); + return Py_BuildValue("s", self->dd->dd_dirname); Py_RETURN_NONE; } @@ -253,12 +253,12 @@ PyObject *p_dd_create(PyObject *module, PyObject *args) return (PyObject*)new_dd; } -/* void delete_dump_dir(const char *dd_dir); */ +/* void delete_dump_dir(const char *dirname); */ PyObject *p_delete_dump_dir(PyObject *pself, PyObject *args) { - const char *dir; - if (!PyArg_ParseTuple(args, "s", &dir)) + const char *dirname; + if (!PyArg_ParseTuple(args, "s", &dirname)) return NULL; - delete_dump_dir(dir); + delete_dump_dir(dirname); Py_RETURN_NONE; } |