/* fork? */
static int fork_to_background;
+/* set to 0 after the first time conky is run, so we don't fork again after the
+ * first forking */
+static int first_pass = 1;
+
static int cpu_avg_samples, net_avg_samples, diskio_avg_samples;
/* filenames for output */
while (1) {
int c = getopt_long(argc, argv, getopt_string, longopts, NULL);
- static int startup_pause = 0;
+ int startup_pause;
if (c == -1) {
break;
break;
#endif /* X11 */
case 'p':
- if (startup_pause == 0) {
+ if (first_pass) {
startup_pause = atoi(optarg);
sleep(startup_pause);
}
}
global_text = NULL;
/* fork */
- if (fork_to_background) {
+ if (fork_to_background && first_pass) {
int pid = fork();
switch (pid) {
initialisation(argc, argv);
+ first_pass = 0; /* don't ever call fork() again */
+
main_loop();
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)