Remove more #ifdef portability hacks
This commit is contained in:
		
							parent
							
								
									608f4fb896
								
							
						
					
					
						commit
						ccac62f7e7
					
				
					 1 changed files with 2 additions and 20 deletions
				
			
		
							
								
								
									
										22
									
								
								timeoutd.c
									
										
									
									
									
								
							
							
						
						
									
										22
									
								
								timeoutd.c
									
										
									
									
									
								
							|  | @ -341,10 +341,8 @@ void read_wtmp() | ||||||
|         if (tm->tm_year != now.tm_year || tm->tm_yday != now.tm_yday) |         if (tm->tm_year != now.tm_year || tm->tm_yday != now.tm_yday) | ||||||
|             break; |             break; | ||||||
| 
 | 
 | ||||||
| #ifndef SUNOS |  | ||||||
|         if (ut.ut_type == USER_PROCESS || ut.ut_type == DEAD_PROCESS || ut.ut_type == UT_UNKNOWN ||     /* SA 19940703 */ |         if (ut.ut_type == USER_PROCESS || ut.ut_type == DEAD_PROCESS || ut.ut_type == UT_UNKNOWN ||     /* SA 19940703 */ | ||||||
|             ut.ut_type == LOGIN_PROCESS || ut.ut_type == BOOT_TIME) |             ut.ut_type == LOGIN_PROCESS || ut.ut_type == BOOT_TIME) | ||||||
| #endif |  | ||||||
|         { |         { | ||||||
|             if ((ut_list_p = (struct ut_list *) |             if ((ut_list_p = (struct ut_list *) | ||||||
|                  malloc(sizeof(struct ut_list))) == NULL) |                  malloc(sizeof(struct ut_list))) == NULL) | ||||||
|  | @ -379,13 +377,8 @@ void free_wtmp() | ||||||
|         tm = localtime(&(wtmplist->elem.ut_time)); |         tm = localtime(&(wtmplist->elem.ut_time)); | ||||||
|         printf("%d:%d %s %s %s\n", tm->tm_hour, tm->tm_min, wtmplist->elem.ut_line, |         printf("%d:%d %s %s %s\n", tm->tm_hour, tm->tm_min, wtmplist->elem.ut_line, | ||||||
|                wtmplist->elem.ut_user, |                wtmplist->elem.ut_user, | ||||||
| #ifndef SUNOS |  | ||||||
|                wtmplist->elem.ut_type == |                wtmplist->elem.ut_type == | ||||||
|                LOGIN_PROCESS ? "login" : wtmplist->elem.ut_type == BOOT_TIME ? "reboot" : "logoff" |                LOGIN_PROCESS ? "login" : wtmplist->elem.ut_type == BOOT_TIME ? "reboot" : "logoff"); | ||||||
| #else |  | ||||||
|                "" |  | ||||||
| #endif |  | ||||||
|             ); |  | ||||||
| #endif | #endif | ||||||
|         ut_list_p = wtmplist; |         ut_list_p = wtmplist; | ||||||
|         wtmplist = wtmplist->next; |         wtmplist = wtmplist->next; | ||||||
|  | @ -667,11 +660,7 @@ char *user; | ||||||
|     while (login_p) |     while (login_p) | ||||||
|     { |     { | ||||||
|         /* For each login on a matching tty find its logout */ |         /* For each login on a matching tty find its logout */ | ||||||
|         if ( |         if (login_p->elem.ut_type == USER_PROCESS && !strncmp(login_p->elem.ut_user, user, 8) | ||||||
| #ifndef SUNOS |  | ||||||
|                login_p->elem.ut_type == USER_PROCESS && |  | ||||||
| #endif |  | ||||||
|                !strncmp(login_p->elem.ut_user, user, 8) |  | ||||||
|                && chkmatch(login_p->elem.ut_line, config[configline]->ttys)) { |                && chkmatch(login_p->elem.ut_line, config[configline]->ttys)) { | ||||||
| #ifdef DEBUG_WTMP | #ifdef DEBUG_WTMP | ||||||
|             struct tm *tm; |             struct tm *tm; | ||||||
|  | @ -689,12 +678,10 @@ char *user; | ||||||
|  * but is better than marking them as logged in for the time the machine |  * but is better than marking them as logged in for the time the machine | ||||||
|  * was down. |  * was down. | ||||||
|  */ |  */ | ||||||
| #ifndef SUNOS |  | ||||||
|                 if (logout_p->elem.ut_type == BOOT_TIME) { |                 if (logout_p->elem.ut_type == BOOT_TIME) { | ||||||
|                     logout_p = prev_p; |                     logout_p = prev_p; | ||||||
|                     break; |                     break; | ||||||
|                 } |                 } | ||||||
| #endif |  | ||||||
|                 if (            /*logout_p->elem.ut_type == DEAD_PROCESS && */ |                 if (            /*logout_p->elem.ut_type == DEAD_PROCESS && */ | ||||||
|                        !strncmp(login_p->elem.ut_line, logout_p->elem.ut_line, UT_LINESIZE)) |                        !strncmp(login_p->elem.ut_line, logout_p->elem.ut_line, UT_LINESIZE)) | ||||||
|                     break; |                     break; | ||||||
|  | @ -882,12 +869,10 @@ void check_idle() | ||||||
|     short aktconfigline = -1;   /* -1 if user is in config; >0 if he's not in config, * is handled in an other way */ |     short aktconfigline = -1;   /* -1 if user is in config; >0 if he's not in config, * is handled in an other way */ | ||||||
| 
 | 
 | ||||||
|     pstat = &status;            /* point to status structure */ |     pstat = &status;            /* point to status structure */ | ||||||
| #ifndef SUNOS |  | ||||||
|     sprintf(path, "/proc/%d", utmpp->ut_pid); |     sprintf(path, "/proc/%d", utmpp->ut_pid); | ||||||
|     if (utmpp->ut_type != USER_PROCESS || !utmpp->ut_user[0] || /* if not user process */ |     if (utmpp->ut_type != USER_PROCESS || !utmpp->ut_user[0] || /* if not user process */ | ||||||
|         stat(path, pstat))      /* or if proc doesn't exist */ |         stat(path, pstat))      /* or if proc doesn't exist */ | ||||||
|         return;                 /* skip the utmp entry */ |         return;                 /* skip the utmp entry */ | ||||||
| #endif |  | ||||||
|     strncpy(user, utmpp->ut_user, sizeof(user) - 1);    /* get user name */ |     strncpy(user, utmpp->ut_user, sizeof(user) - 1);    /* get user name */ | ||||||
|     user[sizeof(user) - 1] = '\0';      /* null terminate user name string */ |     user[sizeof(user) - 1] = '\0';      /* null terminate user name string */ | ||||||
| 
 | 
 | ||||||
|  | @ -1033,9 +1018,6 @@ char *host; | ||||||
| { | { | ||||||
|     int tty; |     int tty; | ||||||
|     pid_t cpid; |     pid_t cpid; | ||||||
| #ifdef SUNOS |  | ||||||
|     struct passwd *pw; |  | ||||||
| #endif |  | ||||||
| 
 | 
 | ||||||
|     if (chk_xsession(dev, host) && !chk_xterm(dev, host)) { |     if (chk_xsession(dev, host) && !chk_xterm(dev, host)) { | ||||||
|         killit_xsession(utmpp->ut_pid, user, host); |         killit_xsession(utmpp->ut_pid, user, host); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Petar Kapris
						Petar Kapris