1 --- openafs.orig/src/bozo/bnode.c
2 +++ openafs/src/bozo/bnode.c
14 register afs_int32 code;
15 + char *corefile = NULL;
16 #ifdef BOZO_SAVE_CORES
18 struct tm *TimeFields;
22 + /* Linux always appends the PID to core dumps from threaded processes, so
23 + * we have to scan the directory to find core files under another name. */
24 code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
27 + struct dirent *file;
32 + logdir = opendir(AFSDIR_LOGS_DIR);
35 + while ((file = readdir(logdir)) != NULL) {
36 + if (strncmp(file->d_name, "core.", 5) != 0)
38 + pid = atol(file->d_name + 5);
39 + if (pid == aproc->pid) {
40 + length = strlen(AFSDIR_LOGS_DIR) + strlen(file->d_name) + 2;
41 + corefile = malloc(length);
42 + if (corefile == NULL) {
46 + snprintf(corefile, length, "%s/%s", AFSDIR_LOGS_DIR,
58 TimeFields->tm_hour, TimeFields->tm_min, TimeFields->tm_sec);
59 strcpy(tbuffer, FileName);
61 - code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
62 + if (corefile == NULL)
63 + code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
65 + code = renamefile(corefile, tbuffer);