Currently in spawn() function is using dup() without return code
validation, i added simple check with additional output to stderr.
--
Michal Kulling
--- init.c-orig 2014-02-10 21:07:17.066060632 +0100
+++ init.c 2014-02-10 21:09:08.518063280 +0100
@@ -1158,8 +1158,15 @@
if ((ftty = console_open(O_RDWR|O_NOCTTY)) >= 0) {
/* Take over controlling tty by force */
(void)ioctl(ftty, TIOCSCTTY, 1);
- dup(ftty);
- dup(ftty);
+
+ if(dup(ftty) < 0){
+ initlog(L_VB, "cannot duplicate console fd");
+ }
+
+ if(dup(ftty) < 0){
+ initlog(L_VB, "cannot duplicate console fd");
+ }
+
}
/*
@@ -1228,8 +1235,15 @@
strerror(errno));
fd = open("/dev/null", O_RDWR);
}
- dup(fd);
- dup(fd);
+
+ if(dup(fd) < 0) {
+ initlog(L_VB, "cannot duplicate /dev/null fd");
+ }
+
+ if(dup(fd) < 0) {
+ initlog(L_VB, "cannot duplicate /dev/null fd");
+ }
+
}
/*