Description of problem: unchecked return values in sysvinit Version-Release number of selected component (if applicable): SysVinit-2.84-13 How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info: Here is the list ./sysvinit-2.84/src/shutdown.c:192: chdir("/"); ### return value of chdir is not checked. ./sysvinit-2.84/src/shutdown.c:578: chdir("/"); ### return value of chdir not checked ./sysvinit-2.84/src/init.c:582: chdir("/"); ### return value of chdir not checked ./sysvinit-2.84/src/sulogin.c:297: (void)chdir(pwd->pw_dir); ### return value of chdir not checked ./sysvinit-2.84/src/halt.c:219: (void)chdir("/"); ### return value of chdir not checked ./sysvinit-2.84/src/bootlogd.c:302: n = fcntl(realfd, F_GETFL); ### return value of fcntl unchecked ./sysvinit-2.84/src/bootlogd.c:304: fcntl(realfd, F_SETFL, n); ### return value of fcntl unchecked ./sysvinit-2.84/src/init.c:501: fcntl(fd, F_SETFL, mode); ### return value of fcntl not checked ./sysvinit-2.84/src/init.c:1813: fcntl(fds[1], F_SETFD, 1); ### return value of fcntl not checked ./sysvinit-2.84/src/init.c:1814: fcntl(fd, F_SETFD, 0); ### return value of fcntl not checked ./sysvinit-2.84/src/bootlogd.c:147: fstat(0, &st); ### return value of fstat not checked ./sysvinit-2.84/src/init.c:1960: fstat(pipe_fd, &st); ### return value of fstat not checked ./sysvinit-2.84/src/init.c:1974: fstat(pipe_fd, &st); ### return value of fstat not checked ./sysvinit-2.84/src/last.c:615: fstat(fileno(fp), &st); ### return value of fstat not checked. ./netkit-ftp-0.17/ftp/ruserpass.c:172: *aacct = malloc((unsigned) strlen(tokval) + 1); ### return value of malloc, *aacct passed to strcpy without checking. ./sysvinit-2.84/src/utmpdump.c:84: struct tm *tm = malloc(sizeof(*tm)); ### return value of malloc passed to strptime without checking. ./sysvinit-2.84/src/utmpdump.c:199: line = linestart = malloc(1024 * sizeof *linestart); ### return value of malloc, line, not checked. notice. its aliased to linestart. ./sysvinit-2.84/src/shutdown.c:579: if (fastboot) close(open(FASTBOOT, O_CREAT | O_RDWR, 0644)); ### return value of open is not checked before being passed to close. ./sysvinit-2.84/src/shutdown.c:580: if (forcefsck) close(open(FORCEFSCK, O_CREAT | O_RDWR, 0644)); ### return value of open is not checked before being passed to close. ./sysvinit-2.84/src/init.c:986: f = open("/dev/null", O_RDWR); ### return value of open not checked before being passed to dup ./sysvinit-2.84/src/init.c:1453: close(open(INITLVL, O_WRONLY|O_TRUNC)); ### return value of open not checked before being passed to close. ./sysvinit-2.84/src/init.c:1469: close(open(INITLVL2, O_WRONLY|O_TRUNC)); ### return value of open not checked before being passed close. ./sysvinit-2.84/src/init.c:2368: (void) close(open(UTMP_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0644)); ### return value of open not checked before being passed to close. ./sysvinit-2.84/src/sulogin.c:415: fd = open(tty, O_RDWR); ### return value of open not checked before being passed to dup. ./sysvinit-2.84/src/init.c:1810: pipe(fds); ### return value of pipe not checked. ./sysvinit-2.84/src/sulogin.c:318: setenv("HOME", home, 1); ### return value of setenv not checked. ./sysvinit-2.84/src/sulogin.c:319: setenv("LOGNAME", "root", 1); ### return value of setenv not checked. ./sysvinit-2.84/src/sulogin.c:320: setenv("USER", "root", 1); ### return value of setenv not checked. ./sysvinit-2.84/src/sulogin.c:322: setenv("SHLVL","0",1); ### return value of setenv not checked. ./sysvinit-2.84/src/sulogin.c:327: setenv("SHELL", sushell, 1); ### return value of setenv not checked. ./sysvinit-2.84/src/sulogin.c:334: setenv("SHELL", BINSH, 1); ### return value of setenv not checked.
This is a very old version, and we don't even build most of these any more. Regardless, at least one issue fixed in 2.86-26.