Skip to content

Commit

Permalink
Fix: Remove extra "gvmd: " from process titles
Browse files Browse the repository at this point in the history
The "gvmd: " prefix is removed from the text passed to calls to
setproctitle.

The function will add a prefix of the executable name on its own,
so it now no longer adds a superfluous one.
  • Loading branch information
timopollmeier committed Aug 22, 2023
1 parent 27bd71a commit d1880af
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 52 deletions.
62 changes: 31 additions & 31 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ accept_and_maybe_fork (int server_socket, sigset_t *sigmask_current)
init_sentry ();
is_parent = 0;

setproctitle ("gvmd: Serving client");
setproctitle ("Serving client");

/* Restore the sigmask that was blanked for pselect. */
pthread_sigmask (SIG_SETMASK, sigmask_current, NULL);
Expand Down Expand Up @@ -736,7 +736,7 @@ fork_connection_internal (gvm_connection_t *client_connection,
/* Child. Serve the scheduler GMP, then exit. */

init_sentry ();
setproctitle ("gvmd: Serving GMP internally");
setproctitle ("Serving GMP internally");

parent_client_socket = sockets[0];

Expand Down Expand Up @@ -834,7 +834,7 @@ fork_connection_internal (gvm_connection_t *client_connection,

g_debug ("%s: %i forked %i", __func__, getpid (), pid);

setproctitle ("gvmd: Requesting GMP internally");
setproctitle ("Requesting GMP internally");

/* This process is returned as the child of
* fork_connection_for_scheduler so that the returned parent can wait
Expand Down Expand Up @@ -1105,7 +1105,7 @@ handle_sigabrt_simple (int signal)
static int
update_nvt_cache_osp (const gchar *update_socket)
{
setproctitle ("gvmd: OSP: Updating NVT cache");
setproctitle ("OSP: Updating NVT cache");

return manage_update_nvts_osp (update_socket);
}
Expand All @@ -1121,7 +1121,7 @@ update_nvt_cache_osp (const gchar *update_socket)
static int
update_nvt_cache_retry ()
{
setproctitle ("gvmd: Reloading NVTs");
setproctitle ("Reloading NVTs");

/* Don't ignore SIGCHLD, in order to wait for child process. */
setup_signal_handler (SIGCHLD, SIG_DFL, 0);
Expand Down Expand Up @@ -1216,7 +1216,7 @@ fork_update_nvt_cache ()
/* Child. */

init_sentry ();
setproctitle ("gvmd: Updating NVT cache");
setproctitle ("Updating NVT cache");

/* Clean up the process. */

Expand Down Expand Up @@ -1327,7 +1327,7 @@ fork_feed_sync ()
/* Child. */

init_sentry ();
setproctitle ("gvmd: Synchronizing feed data");
setproctitle ("Synchronizing feed data");

/* Clean up the process. */

Expand Down Expand Up @@ -2378,7 +2378,7 @@ gvmd (int argc, char** argv, char *env[])
/* Set process title. */

setproctitle_init (argc, argv, env);
setproctitle ("gvmd: Initializing");
setproctitle ("Initializing");

/* Setup initial signal handlers. */

Expand Down Expand Up @@ -2573,7 +2573,7 @@ gvmd (int argc, char** argv, char *env[])
return EXIT_FAILURE;
}

setproctitle ("gvmd: Migrating database");
setproctitle ("Migrating database");

g_info (" Migrating database.");

Expand Down Expand Up @@ -2658,7 +2658,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Optimizing");
setproctitle ("Optimizing");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2674,7 +2674,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: --rebuild");
setproctitle ("--rebuild");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2696,7 +2696,7 @@ gvmd (int argc, char** argv, char *env[])

error_msg = NULL;

setproctitle ("gvmd: --rebuild-gvmd-data");
setproctitle ("--rebuild-gvmd-data");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2721,7 +2721,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: --rebuild-scap");
setproctitle ("--rebuild-scap");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2740,7 +2740,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: --dump-vt-verification");
setproctitle ("--dump-vt-verification");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2763,7 +2763,7 @@ gvmd (int argc, char** argv, char *env[])

/* Create the scanner and then exit. */

setproctitle ("gvmd: Creating scanner");
setproctitle ("Creating scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand Down Expand Up @@ -2815,7 +2815,7 @@ gvmd (int argc, char** argv, char *env[])

/* Modify the scanner and then exit. */

setproctitle ("gvmd: Modifying scanner");
setproctitle ("Modifying scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand Down Expand Up @@ -2859,7 +2859,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Checking alerts");
setproctitle ("Checking alerts");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2874,7 +2874,7 @@ gvmd (int argc, char** argv, char *env[])
if (create_encryption_key)
{
int ret;
setproctitle ("gvmd: Creating encryption key");
setproctitle ("Creating encryption key");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2889,7 +2889,7 @@ gvmd (int argc, char** argv, char *env[])
if (set_encryption_key)
{
int ret;
setproctitle ("gvmd: Setting encryption key");
setproctitle ("Setting encryption key");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2906,7 +2906,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Creating user");
setproctitle ("Creating user");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2923,7 +2923,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Deleting user");
setproctitle ("Deleting user");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2939,7 +2939,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Getting roles");
setproctitle ("Getting roles");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2955,7 +2955,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Getting users");
setproctitle ("Getting users");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2971,7 +2971,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Getting scanners");
setproctitle ("Getting scanners");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -2987,7 +2987,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Deleting scanner");
setproctitle ("Deleting scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3003,7 +3003,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Verifying scanner");
setproctitle ("Verifying scanner");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3019,7 +3019,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Modifying user password");
setproctitle ("Modifying user password");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3035,7 +3035,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Modifying setting");
setproctitle ("Modifying setting");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3052,7 +3052,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Encrypting all credentials");
setproctitle ("Encrypting all credentials");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand All @@ -3068,7 +3068,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;

setproctitle ("gvmd: Decrypting all credentials");
setproctitle ("Decrypting all credentials");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;
Expand Down Expand Up @@ -3319,7 +3319,7 @@ gvmd (int argc, char** argv, char *env[])

/* Enter the main forever-loop. */

setproctitle ("gvmd: Waiting for incoming connections");
setproctitle ("Waiting for incoming connections");
serve_and_schedule ();

gvm_close_sentry ();
Expand Down
10 changes: 5 additions & 5 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2865,7 +2865,7 @@ fork_osp_scan_handler (task_t task, target_t target, int from,
exit (-1);
}

setproctitle ("gvmd: OSP: Handling scan %s", report_id);
setproctitle ("OSP: Handling scan %s", report_id);

rc = handle_osp_scan (task, global_current_report, report_id);
g_free (report_id);
Expand Down Expand Up @@ -3217,7 +3217,7 @@ fork_cve_scan_handler (task_t task, target_t target)

set_task_run_status (task, TASK_STATUS_RUNNING);

setproctitle ("gvmd: CVE: Handling scan %s", report_id);
setproctitle ("CVE: Handling scan %s", report_id);
g_free (report_id);

hosts = target_hosts (target);
Expand Down Expand Up @@ -4764,7 +4764,7 @@ scheduled_task_start (scheduled_task_t *scheduled_task,

/* Parent. Wait for child, to check return. */

setproctitle ("gvmd: scheduler: waiting for %i", pid);
setproctitle ("scheduler: waiting for %i", pid);

g_debug ("%s: %i fork_connectioned %i",
__func__, getpid (), pid);
Expand Down Expand Up @@ -4865,7 +4865,7 @@ scheduled_task_start (scheduled_task_t *scheduled_task,

/* Start the task. */

setproctitle ("gvmd: scheduler: starting %s", scheduled_task->task_uuid);
setproctitle ("scheduler: starting %s", scheduled_task->task_uuid);

auth_opts = gmp_authenticate_info_opts_defaults;
auth_opts.username = scheduled_task->owner_name;
Expand Down Expand Up @@ -4956,7 +4956,7 @@ scheduled_task_stop (scheduled_task_t *scheduled_task,

/* Stop the task. */

setproctitle ("gvmd: scheduler: stopping %s",
setproctitle ("scheduler: stopping %s",
scheduled_task->task_uuid);

auth_opts = gmp_authenticate_info_opts_defaults;
Expand Down
8 changes: 4 additions & 4 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -9633,7 +9633,7 @@ alert_script_exec (const char *alert_id, const char *command_args,
init_sentry ();
cleanup_manage_process (FALSE);

setproctitle ("gvmd: Running alert script");
setproctitle ("Running alert script");

if (setgroups (0,NULL))
{
Expand Down Expand Up @@ -10446,7 +10446,7 @@ send_to_sourcefire (const char *ip, const char *port, const char *pkcs12_64,
init_sentry ();
cleanup_manage_process (FALSE);

setproctitle ("gvmd: Sending to Sourcefire");
setproctitle ("Sending to Sourcefire");

if (setgroups (0,NULL))
{
Expand Down Expand Up @@ -10775,7 +10775,7 @@ send_to_verinice (const char *url, const char *username, const char *password,
{
/* Child. Drop privileges, run command, exit. */
init_sentry ();
setproctitle ("gvmd: Sending to Verinice");
setproctitle ("Sending to Verinice");

cleanup_manage_process (FALSE);

Expand Down Expand Up @@ -20905,7 +20905,7 @@ create_report (array_t *results, const char *task_id, const char *in_assets,
}
}

setproctitle ("gvmd: Importing results");
setproctitle ("Importing results");

/* Add the results. */

Expand Down
2 changes: 1 addition & 1 deletion src/manage_sql_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -3416,7 +3416,7 @@ run_report_format_script (gchar *report_format_id,
/* Child. Drop privileges, run command, exit. */

init_sentry ();
setproctitle ("gvmd: Generating report");
setproctitle ("Generating report");

cleanup_manage_process (FALSE);

Expand Down
Loading

0 comments on commit d1880af

Please sign in to comment.