source:
patches/sysvinit-2.86-fixes-1.patch@
369d5d6
Last change on this file since 369d5d6 was de28452, checked in by , 16 years ago | |
---|---|
|
|
File size: 20.5 KB |
-
sysvinit-2.86
Submitted By: Jim Gifford (jim at cross-lfs dot org) Date: 01-07-2008 Initial Package Version: 2.86 Origin: Various Upstream Status: Unknown Description: Fixes to Major issues in Sysvinit -- listed Below IPV6 Displayed Incorrectly On 64bit which have 32bit multilib support, the utmp struct is the same Fix bug where proc names are truncated Fixed support for POSIX capabilite All halt/reboot to handle being called by login correctly Preserve waiting state across re-exec Allow failed console opens some time to resolve themselves New: Added kexec support diff -Naur sysvinit-2.86.orig/man/halt.8 sysvinit-2.86/man/halt.8
old new 23 23 .RB [ \-d ] 24 24 .RB [ \-f ] 25 25 .RB [ \-i ] 26 .RB [ \-k ] 26 27 .br 27 28 .B /sbin/poweroff 28 29 .RB [ \-n ] … … 65 66 .IP \fB\-p\fP 66 67 When halting the system, do a poweroff. This is the default when halt is 67 68 called as \fBpoweroff\fP. 69 .IP \fB\-k\fP 70 Try to reboot using \fBkexec\fP, if kernel supports it. 68 71 .\"}}} 69 72 .\"{{{ Diagnostics 70 73 .SH DIAGNOSTICS -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/man/init.8 sysvinit-2.86/man/init.8
old new 64 64 .PP 65 65 Runlevel \fBS\fP or \fBs\fP bring the system to single user mode 66 66 and do not require an \fB/etc/inittab\fP file. In single user mode, 67 \fB/sbin/sulogin\fP is invoked on \fB/dev/console\fP.67 a root shell is opened on \fB/dev/console\fP. 68 68 .PP 69 69 When entering single user mode, \fBinit\fP initializes the consoles 70 70 \fBstty\fP settings to sane values. Clocal mode is set. Hardware -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/man/last.1 sysvinit-2.86/man/last.1
old new 60 60 useful, e.g., to determine easily who was logged in at a particular 61 61 time -- specify that time with \fB\-t\fP and look for "still logged 62 62 in". 63 .IP "\fB\-f\fP \fIfile\fP" 64 Specifies a file to search other than \fB/var/log/wtmp\fP. 63 65 .IP \fB\-R\fP 64 66 Suppresses the display of the hostname field. 65 67 .IP \fB\-a\fP -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/man/pidof.8 sysvinit-2.86/man/pidof.8
old new 4 4 .SH SYNOPSIS 5 5 .B pidof 6 6 .RB [ \-s ] 7 .RB [ \-c ] 7 8 .RB [ \-x ] 8 9 .RB [ \-o 9 10 .IR omitpid ] … … 24 25 .SH OPTIONS 25 26 .IP -s 26 27 Single shot - this instructs the program to only return one \fIpid\fP. 28 .IP -c 29 Only return process ids that are running with the same root directory. 30 This option is ignored for non-root users, as they will be unable to check 31 the current root directory of processes they do not own. 27 32 .IP -x 28 33 Scripts too - this causes the program to also return process id's of 29 34 shells running the named scripts. -
man/shutdown.8
diff -Naur sysvinit-2.86.orig/man/shutdown.8 sysvinit-2.86/man/shutdown.8
old new 9 9 .\"{{{ Synopsis 10 10 .SH SYNOPSIS 11 11 .B /sbin/shutdown 12 .RB [ \-akrhPHfFnc ] 12 13 .RB [ \-t 13 14 .IR sec ] 14 .RB [ \-arkhncfFHP ]15 15 .I time 16 .RI [ warning-message]16 .RI [ "warning message" ] 17 17 .\"}}} 18 18 .\"{{{ Description 19 19 .SH DESCRIPTION … … 39 39 .IP "\fB\-a\fP 40 40 Use \fB/etc/shutdown.allow\fP. 41 41 .\"}}} 42 .\"{{{ -t sec43 .IP "\fB\-t\fP \fIsec\fP"44 Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending processes the45 warning and the kill signal, before changing to another runlevel.46 .\"}}}47 42 .\"{{{ -k 48 43 .IP \fB\-k\fP 49 44 Don't really shutdown; only send the warning messages to everybody. … … 56 51 .IP \fB\-h\fP 57 52 Halt or poweroff after shutdown. 58 53 .\"}}} 59 .\"{{{ -H60 .IP \fB\-H\fP61 Halt action is to halt or drop into boot monitor on systems that62 support it.63 .\"}}}64 54 .\"{{{ -P 65 55 .IP \fB\-P\fP 66 56 Halt action is to turn off the power. 67 57 .\"}}} 68 .\"{{{ -n 69 .IP \fB\-n\fP 70 [DEPRECATED] Don't call \fBinit\fP(8) to do the shutdown but do it ourself. 71 The use of this option is discouraged, and its results are not always what 72 you'd expect. 58 .\"{{{ -H 59 .IP \fB\-H\fP 60 Halt action is to halt or drop into boot monitor on systems that 61 support it. 73 62 .\"}}} 74 63 .\"{{{ -f 75 64 .IP \fB\-f\fP … … 79 68 .IP \fB\-F\fP 80 69 Force fsck on reboot. 81 70 .\"}}} 71 .\"{{{ -n 72 .IP \fB\-n\fP 73 [DEPRECATED] Don't call \fBinit\fP(8) to do the shutdown but do it ourself. 74 The use of this option is discouraged, and its results are not always what 75 you'd expect. 76 .\"}}} 82 77 .\"{{{ -c 83 78 .IP \fB\-c\fP 84 79 Cancel an already running shutdown. With this option it is of course 85 80 not possible to give the \fBtime\fP argument, but you can enter a 86 81 explanatory message on the command line that will be sent to all users. 87 82 .\"}}} 83 .\"{{{ -t sec 84 .IP "\fB\-t\fP \fIsec\fP" 85 Tell \fBinit\fP(8) to wait \fIsec\fP seconds between sending processes the 86 warning and the kill signal, before changing to another runlevel. 87 .\"}}} 88 88 .\"{{{ time 89 89 .IP \fItime\fP 90 90 When to shutdown. 91 91 .\"}}} 92 92 .\"{{{ warning-message 93 .IP \fIwarning-message\fP93 .IP "\fIwarning message\fP" 94 94 Message to send to all users. 95 95 .\"}}} 96 96 .PP -
man/sulogin.8
diff -Naur sysvinit-2.86.orig/man/sulogin.8 sysvinit-2.86/man/sulogin.8
old new 9 9 .RB [ " tty-device " ] 10 10 .SH DESCRIPTION 11 11 .I sulogin 12 isinvoked by \fBinit(8)\fP when the system goes into single user mode12 can be invoked by \fBinit(8)\fP when the system goes into single user mode 13 13 (this is done through an entry in \fIinittab(5)\fP). \fBInit\fP also 14 14 tries to execute \fIsulogin\fP when it is passed the \fB-b\fP flag 15 15 from the bootmonitor (eg, LILO). -
src/bootlogd.c
diff -Naur sysvinit-2.86.orig/src/bootlogd.c sysvinit-2.86/src/bootlogd.c
old new 609 609 else 610 610 todo = endptr - outptr; 611 611 if (fp && todo) 612 writelog(fp, outptr, todo);612 writelog(fp, (unsigned char *)outptr, todo); 613 613 } 614 614 615 615 if (fp) { -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/src/halt.c sysvinit-2.86/src/halt.c
old new 8 8 * execute an "shutdown -r". This is for compatibility with 9 9 * sysvinit 2.4. 10 10 * 11 * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p] 11 * Usage: halt [-n] [-w] [-d] [-f] [-h] [-i] [-p] [-k] 12 12 * -n: don't sync before halting the system 13 13 * -w: only write a wtmp reboot record and exit. 14 14 * -d: don't write a wtmp record. … … 16 16 * -h: put harddisks in standby mode 17 17 * -i: shut down all network interfaces. 18 18 * -p: power down the system (if possible, otherwise halt). 19 * -k: reboot the system using kexec. 19 20 * 20 21 * Reboot and halt are both this program. Reboot 21 22 * is just a link to halt. Invoking the program … … 64 65 */ 65 66 void usage(void) 66 67 { 67 fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n", 68 progname, strcmp(progname, "halt") ? "" : " [-p]"); 68 fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s%s\n", 69 progname, 70 strcmp(progname, "halt") ? "" : " [-p]", 71 strcmp(progname, "reboot") ? "" : " [-k]"); 69 72 fprintf(stderr, "\t-n: don't sync before halting the system\n"); 70 73 fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n"); 71 74 fprintf(stderr, "\t-d: don't write a wtmp record.\n"); … … 74 77 fprintf(stderr, "\t-i: shut down all network interfaces.\n"); 75 78 if (!strcmp(progname, "halt")) 76 79 fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n"); 80 if (!strcmp(progname, "reboot")) 81 fprintf(stderr, "\t-k: reboot the system using kexec.\n"); 77 82 exit(1); 78 83 } 79 84 … … 172 177 int do_ifdown = 0; 173 178 int do_hddown = 0; 174 179 int do_poweroff = 0; 180 int do_kexec = 0; 175 181 int c; 176 182 char *tm = NULL; 177 183 178 184 /* 179 185 * Find out who we are 180 186 */ 187 if (argv[0][0] == '-') argv[0]++; 181 188 if ((progname = strrchr(argv[0], '/')) != NULL) 182 189 progname++; 183 190 else … … 189 196 /* 190 197 * Get flags 191 198 */ 192 while((c = getopt(argc, argv, ":ihdfnpw t:")) != EOF) {199 while((c = getopt(argc, argv, ":ihdfnpwkt:")) != EOF) { 193 200 switch(c) { 194 201 case 'n': 195 202 do_sync = 0; … … 213 220 case 'p': 214 221 do_poweroff = 1; 215 222 break; 223 case 'k': 224 do_kexec = 1; 225 break; 216 226 case 't': 217 227 tm = optarg; 218 228 break; … … 230 240 (void)chdir("/"); 231 241 232 242 if (!do_hard && !do_nothing) { 243 c = get_runlevel(); 244 245 /* 246 * We can't reboot using kexec through this path. 247 */ 248 if (c != '6' && do_reboot && do_kexec) { 249 fprintf(stderr, "ERROR: using -k at this" 250 " runlevel requires also -f\n" 251 " (You probably want instead to reboot" 252 " normally and let your reboot\n" 253 " script, usually /etc/init.d/reboot," 254 " specify -k)\n"); 255 exit(1); 256 } 257 233 258 /* 234 259 * See if we are in runlevel 0 or 6. 235 260 */ 236 c = get_runlevel(); 237 if (c != '0' && c != '6') 238 do_shutdown(do_reboot ? "-r" : "-h", tm); 261 if (c != '0' && c != '6') { 262 char *file; 263 264 if (do_poweroff) { 265 file = strdup("/poweroff"); 266 } else { 267 file = strdup("/halt"); 268 } 269 close(open(file, O_CREAT|O_RDWR, 0644)); 270 free(file); 271 272 do_shutdown(do_reboot ? "-r" : "-h", tm); 273 } 239 274 } 240 275 241 276 /* … … 263 298 if (do_nothing) exit(0); 264 299 265 300 if (do_reboot) { 301 /* 302 * kexec or reboot 303 */ 304 if (do_kexec) { 305 init_reboot(BMAGIC_KEXEC); 306 } 307 308 /* 309 * Fall through if failed 310 */ 266 311 init_reboot(BMAGIC_REBOOT); 267 312 } else { 268 313 /* -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/src/init.c sysvinit-2.86/src/init.c
old new 185 185 {"RU",RUNNING}, 186 186 {"DE",DEMAND}, 187 187 {"XD",XECUTED}, 188 {"WT",WAITING}, 188 189 {NULL,0} 189 190 }; 190 191 … … 466 467 467 468 if (maxproclen > 2) { 468 469 memset(argv0, 0, maxproclen); 469 strncpy(argv0, buf, maxproclen - 2);470 strncpy(argv0, buf, maxproclen - 1); 470 471 } 471 472 472 473 return len; … … 527 528 /* 528 529 * Retry the open five times. 529 530 */ 530 for(f = 0; f < 5; f++) 531 for(f = 0; f < 5; f++) { 531 532 if ((fd = open(console_dev, m)) >= 0) break; 533 usleep(100); 534 } 532 535 533 536 if (fd < 0) return fd; 534 537 … … 949 952 sigprocmask(SIG_SETMASK, &omask, NULL); 950 953 951 954 /* 955 * Update utmp/wtmp file prior to starting 956 * any child. This MUST be done right here in 957 * the child process in order to prevent a race 958 * condition that occurs when the child 959 * process' time slice executes before the 960 * parent (can and does happen in a uniprocessor 961 * environment). If the child is a getty and 962 * the race condition happens, then init's utmp 963 * update will happen AFTER the getty runs 964 * and expects utmp to be updated already! 965 * 966 * Do NOT log if process field starts with '+' 967 * FIXME: that's for compatibility with *very* 968 * old getties - probably it can be taken out. 969 */ 970 if (ch->action == RESPAWN && ch->process[0] != '+') 971 write_utmp_wtmp("", ch->id, getpid(), INIT_PROCESS, ""); 972 973 /* 952 974 * In sysinit, boot, bootwait or single user mode: 953 975 * for any wait-type subprocess we _force_ the console 954 976 * to be its controlling tty. 955 977 */ 956 if ( strchr("*#sS", runlevel) && ch->flags & WAITING) {978 if ((strchr("*#sS", runlevel) || (ch->id[0] == 'l' && isdigit(ch->id[1]))) && ch->flags & WAITING) { 957 979 /* 958 980 * We fork once extra. This is so that we can 959 981 * wait and change the process group and session … … 1088 1110 case ONDEMAND: 1089 1111 case RESPAWN: 1090 1112 ch->flags |= RUNNING; 1091 if (spawn(ch, &(ch->pid)) < 0) break; 1092 /* 1093 * Do NOT log if process field starts with '+' 1094 * FIXME: that's for compatibility with *very* 1095 * old getties - probably it can be taken out. 1096 */ 1097 if (ch->process[0] != '+') 1098 write_utmp_wtmp("", ch->id, ch->pid, 1099 INIT_PROCESS, ""); 1113 (void)spawn(ch, &(ch->pid)); 1100 1114 break; 1101 1115 } 1102 1116 } … … 1373 1387 case 0: /* Send TERM signal */ 1374 1388 if (talk) 1375 1389 initlog(L_CO, 1376 "Sending processes the TERM signal");1390 "Sending processes started by init the TERM signal"); 1377 1391 kill(-(ch->pid), SIGTERM); 1378 1392 foundOne = 1; 1379 1393 break; 1380 1394 case 1: /* Send KILL signal and collect status */ 1381 1395 if (talk) 1382 1396 initlog(L_CO, 1383 "Sending processes the KILL signal");1397 "Sending processes started by init the KILL signal"); 1384 1398 kill(-(ch->pid), SIGKILL); 1385 1399 break; 1386 1400 } … … 1884 1898 * The existing init process execs a new init binary. 1885 1899 */ 1886 1900 env = init_buildenv(0); 1887 execl (myname, myname, "--init", NULL, env);1901 execle(myname, myname, "--init", NULL, env); 1888 1902 1889 1903 /* 1890 1904 * We shouldn't be here, something failed. -
src/killall5.c
diff -Naur sysvinit-2.86.orig/src/killall5.c sysvinit-2.86/src/killall5.c
old new 51 51 char *argv0base; /* `basename argv[1]` */ 52 52 char *argv1; /* Name as found out from argv[1] */ 53 53 char *argv1base; /* `basename argv[1]` */ 54 char *pathname; /* full path to executable */ 54 55 char *statname; /* the statname without braces */ 55 ino_t ino; /* Inode number */56 dev_t dev; /* Device it is on */57 56 pid_t pid; /* Process ID. */ 58 57 int sid; /* Session ID. */ 59 58 int kernel; /* Kernel thread or zombie. */ … … 172 171 FILE *fp; 173 172 PROC *p, *n; 174 173 struct dirent *d; 175 struct stat st;176 174 char path[256]; 177 175 char buf[256]; 178 176 char *s, *q; … … 191 189 n = p->next; 192 190 if (p->argv0) free(p->argv0); 193 191 if (p->argv1) free(p->argv1); 192 if (p->pathname) free(p->pathname); 193 if (p->statname) free(p->statname); 194 194 free(p); 195 195 } 196 196 plist = NULL; … … 248 248 p->sid = 0; 249 249 nsyslog(LOG_ERR, "can't read sid from %s\n", 250 250 path); 251 if (p->statname) free(p->statname); 251 252 free(p); 252 253 continue; 253 254 } … … 300 301 301 302 } else { 302 303 /* Process disappeared.. */ 304 if (p->statname) free(p->statname); 303 305 free(p); 304 306 continue; 305 307 } 306 308 307 309 /* Try to stat the executable. */ 308 310 snprintf(path, sizeof(path), "/proc/%s/exe", d->d_name); 309 if (stat(path, &st) == 0) { 310 p->dev = st.st_dev; 311 p->ino = st.st_ino; 311 p->pathname = (char *)xmalloc(PATH_MAX); 312 if (readlink(path, p->pathname, PATH_MAX) == -1) { 313 p->pathname = NULL; 314 } else { 315 p->pathname[PATH_MAX-1] = '\0'; 312 316 } 313 317 314 318 /* Link it into the list. */ … … 372 376 { 373 377 PROC *p; 374 378 PIDQ_HEAD *q; 375 struct stat st;376 379 char *s; 377 380 int dostat = 0; 378 381 int foundone = 0; 379 382 int ok = 0; 383 char *real_path; 380 384 381 385 /* Try to stat the executable. */ 382 if (prog[0] == '/' && stat(prog, &st) == 0) dostat++;386 if (prog[0] == '/' && (real_path = canonicalize_file_name(prog))) dostat++; 383 387 384 388 /* Get basename of program. */ 385 389 if ((s = strrchr(prog, '/')) == NULL) … … 390 394 q = (PIDQ_HEAD *)xmalloc(sizeof(PIDQ_HEAD)); 391 395 q = init_pid_q(q); 392 396 393 /* First try to find a match based on dev/ino pair. */397 /* First try to find a match based on pathname. */ 394 398 if (dostat) { 395 399 for (p = plist; p; p = p->next) { 396 if (p-> dev == st.st_dev && p->ino == st.st_ino) {400 if (p->pathname && strcmp(real_path, p->pathname) == 0) { 397 401 add_pid_to_q(q, p); 398 402 foundone++; 399 403 } … … 408 412 ok += (p->argv0 && strcmp(p->argv0, prog) == 0); 409 413 ok += (p->argv0 && strcmp(p->argv0base, s) == 0); 410 414 415 if (prog[0] == '/' && p->pathname && strcmp(prog, p->pathname)) 416 ok = 0; 417 411 418 /* For scripts, compare argv[1] as well. */ 412 419 if (scripts_too && p->argv1 && 413 420 !strncmp(p->statname, p->argv1base, STATNAMELEN)) { 414 421 ok += (strcmp(p->argv1, prog) == 0); 415 ok += (strcmp(p->argv1base, s) == 0);422 if (prog[0] != '/') ok += (strcmp(p->argv1base, s) == 0); 416 423 } 417 424 418 425 /* … … 476 483 int f; 477 484 int first = 1; 478 485 int i, oind, opt, flags = 0; 486 int chroot_check = 0; 487 struct stat st; 488 char tmp[512]; 479 489 480 490 for (oind = PIDOF_OMITSZ-1; oind > 0; oind--) 481 491 opid[oind] = 0; 482 492 opterr = 0; 483 493 484 while ((opt = getopt(argc,argv,"h o:sx")) != EOF) switch (opt) {494 while ((opt = getopt(argc,argv,"hco:sx")) != EOF) switch (opt) { 485 495 case '?': 486 496 nsyslog(LOG_ERR,"invalid options on command line!\n"); 487 497 closelog(); 488 498 exit(1); 499 case 'c': 500 if (geteuid() == 0) chroot_check = 1; 501 break; 489 502 case 'o': 490 503 if (oind >= PIDOF_OMITSZ -1) { 491 504 nsyslog(LOG_ERR,"omit pid buffer size %d " … … 518 531 argc -= optind; 519 532 argv += optind; 520 533 534 /* Check if we are in a chroot */ 535 if (chroot_check) { 536 snprintf(tmp, 512, "/proc/%d/root", getpid()); 537 if (stat(tmp, &st) < 0) { 538 nsyslog(LOG_ERR, "stat failed for %s!\n", tmp); 539 closelog(); 540 exit(1); 541 } 542 } 543 521 544 /* Print out process-ID's one by one. */ 522 545 readproc(); 523 546 for(f = 0; f < argc; f++) { … … 541 564 else 542 565 spid = 1; 543 566 } 567 if (chroot_check) { 568 struct stat st2; 569 snprintf(tmp, 512, "/proc/%d/root", 570 p->pid); 571 if (stat(tmp, &st2) < 0 || 572 st.st_dev != st2.st_dev || 573 st.st_ino != st2.st_ino) { 574 continue; 575 } 576 } 544 577 if (!first) 545 578 printf(" "); 546 579 printf("%d", p->pid); -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/src/last.c sysvinit-2.86/src/last.c
old new 307 307 struct sockaddr *sa; 308 308 int salen, flags; 309 309 unsigned int topnibble; 310 unsigned int azero = 0, sitelocal = 0; 310 311 int mapped = 0; 311 312 312 313 flags = useip ? NI_NUMERICHOST : 0; 313 314 314 315 /* 315 316 * IPv4 or IPv6 ? We use 2 heuristics: 316 * 1. Current IPv6 range uses 2000-3fff . Outside of317 * that is illegal and must be IPv4.317 * 1. Current IPv6 range uses 2000-3fff or fec0-feff. 318 * Outside of that is illegal and must be IPv4. 318 319 * 2. If last 3 bytes are 0, must be IPv4 319 320 * 3. If IPv6 in IPv4, handle as IPv4 320 321 * … … 323 324 if (a[0] == 0 && a[1] == 0 && a[2] == htonl (0xffff)) 324 325 mapped = 1; 325 326 topnibble = ntohl((unsigned int)a[0]) >> 28; 326 if (topnibble < 2 || topnibble > 3 || mapped || 327 328 azero = ntohl((unsigned int)a[0]) >> 16; 329 sitelocal = (azero >= 0xfec0 && azero <= 0xfeff) ? 1 : 0; 330 331 if (((topnibble < 2 || topnibble > 3) && (!sitelocal)) || mapped || 327 332 (a[1] == 0 && a[2] == 0 && a[3] == 0)) { 328 333 /* IPv4 */ 329 334 sin.sin_family = AF_INET; -
src/reboot.h
diff -Naur sysvinit-2.86.orig/src/reboot.h sysvinit-2.86/src/reboot.h
old new 32 32 # define BMAGIC_POWEROFF BMAGIC_HALT 33 33 #endif 34 34 35 /* for kexec support */ 36 #define BMAGIC_KEXEC 0x45584543 37 35 38 #define init_reboot(magic) reboot(magic) 36 39 -
src/shutdown.c
diff -Naur sysvinit-2.86.orig/src/shutdown.c sysvinit-2.86/src/shutdown.c
old new 102 102 void usage(void) 103 103 { 104 104 fprintf(stderr, 105 "Usage:\t shutdown [-akrh HPfnc] [-t secs] time [warning message]\n"105 "Usage:\t shutdown [-akrhPHfFnc] [-t sec] time [warning message]\n" 106 106 "\t\t -a: use /etc/shutdown.allow\n" 107 107 "\t\t -k: don't really shutdown, only warn.\n" 108 108 "\t\t -r: reboot after shutdown.\n" … … 460 460 461 461 if (getuid() != 0) { 462 462 fprintf(stderr, "shutdown: you must be root to do that!\n"); 463 usage(); 463 464 exit(1); 464 465 } 465 466 strcpy(down_level, "1"); -
sysvinit-2.86
diff -Naur sysvinit-2.86.orig/src/utmp.c sysvinit-2.86/src/utmp.c
old new 47 47 int fd; 48 48 struct utmp utmp; 49 49 struct utsname uname_buf; 50 struct timeval tv; 50 51 51 52 /* 52 53 * Try to open the wtmp file. Note that we even try … … 76 77 */ 77 78 memset(&utmp, 0, sizeof(utmp)); 78 79 #if defined(__GLIBC__) 79 gettimeofday(&utmp.ut_tv, NULL); 80 gettimeofday(&tv, NULL); 81 utmp.ut_tv.tv_sec = tv.tv_sec; 82 utmp.ut_tv.tv_usec = tv.tv_usec; 80 83 #else 81 84 time(&utmp.ut_time); 82 85 #endif … … 113 116 struct utmp utmp; 114 117 struct utmp tmp; 115 118 struct utmp *utmptr; 119 struct timeval tv; 116 120 117 121 /* 118 122 * Can't do much if UTMP_FILE is not present. … … 144 148 utmp.ut_pid = pid; 145 149 strncpy(utmp.ut_id, id, sizeof(utmp.ut_id)); 146 150 #if defined(__GLIBC__) 147 gettimeofday(&utmp.ut_tv, NULL); 151 gettimeofday(&tv, NULL); 152 utmp.ut_tv.tv_sec = tv.tv_sec; 153 utmp.ut_tv.tv_usec = tv.tv_usec; 148 154 #else 149 155 time(&utmp.ut_time); 150 156 #endif
Note:
See TracBrowser
for help on using the repository browser.