View | Details | Raw Unified | Return to bug 6606
Collapse All | Expand All

(-)src.orig/common.c (-1 / +1 lines)
Lines 203-209 Link Here
203
void termination(int signal){
203
void termination(int signal){
204
	global_return_code=signal;
204
	global_return_code=signal;
205
	sleep(1); //we should wait until sMain is sleeping, this is not guarantee this
205
	sleep(1); //we should wait until sMain is sleeping, this is not guarantee this
206
	printf("\n");
206
//	printf("\n");
207
	if(signal==PARSE_KILL || signal==SIGKILL) {
207
	if(signal==PARSE_KILL || signal==SIGKILL) {
208
		aMemoryRelease();
208
		aMemoryRelease();
209
		char buf[32];
209
		char buf[32];
(-)src.orig/main.c (-13 / +13 lines)
Lines 73-90 Link Here
73
		setvbuf(LOGFILE, NULL, _IOLBF, 0);
73
		setvbuf(LOGFILE, NULL, _IOLBF, 0);
74
	}
74
	}
75
	
75
	
76
	if (flag_pid && !flag_nopid) {
77
		if (pid_file_name==NULL) pid_file_name=set_string("/var/run/netams.pid");
78
		FILE *pidfile = fopen(pid_file_name, "wt");
79
	
80
		if (pidfile!=NULL) {
81
			fprintf(pidfile, "%u\n", getpid());
82
			fclose(pidfile);
83
		} else {
84
			fprintf(stderr, "Can't create pid-file: %s\n", strerror(errno));
85
		}
86
	}
87
88
	if (flag_syslog) openlog("netams", 0, LOG_DAEMON);
76
	if (flag_syslog) openlog("netams", 0, LOG_DAEMON);
89
	if (!flag_quiet) aShowVersion(stdout);
77
	if (!flag_quiet) aShowVersion(stdout);
90
	if (flag_log) aShowVersion(LOGFILE);
78
	if (flag_log) aShowVersion(LOGFILE);
Lines 99-108 Link Here
99
		if(chdir(RUN_PATH)<0)
87
		if(chdir(RUN_PATH)<0)
100
			aLog(D_CRIT, "Cannot chdir to directory %s: %s\n",RUN_PATH,strerror(errno));
88
			aLog(D_CRIT, "Cannot chdir to directory %s: %s\n",RUN_PATH,strerror(errno));
101
		aLog(D_INFO, "Becoming a daemon...\n");
89
		aLog(D_INFO, "Becoming a daemon...\n");
102
		daemon(1, 1);
90
		daemon(1, !flag_quiet);
103
	} else
91
	} else
104
		aLog(D_INFO, "Stay in debug mode...\n");
92
		aLog(D_INFO, "Stay in debug mode...\n");
105
	        
93
	        
94
	if (flag_pid && !flag_nopid) {
95
		if (pid_file_name==NULL) pid_file_name=set_string("/var/run/netams.pid");
96
		FILE *pidfile = fopen(pid_file_name, "wt");
97
	
98
		if (pidfile!=NULL) {
99
			fprintf(pidfile, "%u\n", getpid());
100
			fclose(pidfile);
101
		} else {
102
			fprintf(stderr, "Can't create pid-file: %s\n", strerror(errno));
103
		}
104
	}
105
106
	// handling signals
106
	// handling signals
107
	signal(SIGHUP, (sig_t)logrotate);
107
	signal(SIGHUP, (sig_t)logrotate);
108
	signal(SIGQUIT, (sig_t)termination);
108
	signal(SIGQUIT, (sig_t)termination);
(-)src.orig/netamsctl.c (-2 lines)
Lines 47-54 Link Here
47
		sprintf(str, "%s/.netamsctl.rc", homedir);
47
		sprintf(str, "%s/.netamsctl.rc", homedir);
48
		RCFILE=fopen(str, "rt");
48
		RCFILE=fopen(str, "rt");
49
	}
49
	}
50
	if (!RCFILE) RCFILE=fopen(".netamsctl.rc", "rt");
51
	if (!RCFILE) RCFILE=fopen("/usr/local/etc/.netamsctl.rc", "rt");
52
	if (!RCFILE) RCFILE=fopen("/etc/.netamsctl.rc", "rt");
50
	if (!RCFILE) RCFILE=fopen("/etc/.netamsctl.rc", "rt");
53
	if (!RCFILE) { printf("unable to open .rc file\n"); exit(-1); }
51
	if (!RCFILE) { printf("unable to open .rc file\n"); exit(-1); }
54
	}
52
	}
(-)src.orig/netams.h (-1 / +1 lines)
Lines 14-20 Link Here
14
14
15
#include "config.h"
15
#include "config.h"
16
16
17
#define RUN_PATH 	"/var/netams"
17
#define RUN_PATH 	"/var/lib/netams"
18
18
19
// Includes of local definitions
19
// Includes of local definitions
20
class Connection;
20
class Connection;

Return to bug 6606