Skip to content

Commit

Permalink
Keep original thread name for main thread (#1208) (#1209)
Browse files Browse the repository at this point in the history
Fixes e.g. `killall` not matching the general process by (binary) name.
  • Loading branch information
basicmaster authored Mar 5, 2025
1 parent d455669 commit 2334430
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/socketworks.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,16 +702,15 @@ void *select_and_execute(void *arg) {
return NULL;
}

tid = get_tid();
memset(thread_info[thread_index].thread_name, 0,
sizeof(thread_info[thread_index].thread_name));
if (arg) {
safe_strncpy(thread_info[thread_index].thread_name, (char *)arg);
pthread_setname_np(tid, thread_info[thread_index].thread_name);
} else
strcpy(thread_info[thread_index].thread_name, "main");

tid = get_tid();
pthread_setname_np(tid, thread_info[thread_index].thread_name);

select_timeout = SELECT_TIMEOUT;
thread_info[thread_index].tid = tid;
les = 1;
Expand Down

0 comments on commit 2334430

Please sign in to comment.