Squashed commit of the following:
commit
db5d675a41a376734931ec2b3cea3dfa805b052b
Author: Carter Waxman <cwaxman@cisco.com>
Date: Mon Feb 27 11:25:19 2017 -0500
pid file is created regardless of priv drop settings
// FIXIT-L Make this call and the one below exit more gracefully upon error
if (!Snort::drop_privileges())
FatalError("Failed to drop privileges!\n");
+
+ Snort::do_pidfile();
broadcast(new ACStart());
}
else
+ {
+ Snort::do_pidfile();
pig.queue_command(new ACStart());
+ }
break;
case Analyzer::State::STARTED:
}
if (pending_privileges)
break;
+
if (!Snort::drop_privileges())
FatalError("Failed to drop privileges!\n");
+
+ Snort::do_pidfile();
broadcast(new ACRun());
}
else
+ {
+ Snort::do_pidfile();
pig.queue_command(new ACRun());
+ }
break;
case Analyzer::State::STOPPED:
return false;
}
- if (SnortConfig::create_pid_file())
- CreatePidFile(snort_main_thread_pid);
-
initializing = false;
privileges_dropped = true;
return true;
}
+void Snort::do_pidfile()
+{
+ static bool pid_file_created = false;
+
+ if (SnortConfig::create_pid_file() && !pid_file_created)
+ {
+ CreatePidFile(snort_main_thread_pid);
+ pid_file_created = true;
+ }
+}
+
//-------------------------------------------------------------------------
// termination
//-------------------------------------------------------------------------
static SnortConfig* get_reload_config(const char* fname);
static void setup(int argc, char* argv[]);
static bool drop_privileges();
+ static void do_pidfile();
static void cleanup();
static bool is_starting();