Ticket #106: rc-logger-tty.patch
File rc-logger-tty.patch, 1.3 KB (added by mwrobel, 17 months ago) |
---|
-
src/rc/rc-logger.c
old new 150 150 int i; 151 151 FILE *log = NULL; 152 152 153 if (!isatty(STDOUT_FILENO))154 return;155 156 153 if (!rc_conf_yesno("rc_logger")) 157 154 return; 158 155 … … 163 160 fcntl (signal_pipe[i], F_SETFD, s | FD_CLOEXEC) == -1)) 164 161 eerrorx("fcntl: %s", strerror (errno)); 165 162 166 tcgetattr(STDOUT_FILENO, &tt); 167 ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); 168 169 /* /dev/pts may not be available yet */ 170 if (openpty(&rc_logger_tty, &slave_tty, NULL, &tt, &ws)) 171 return; 163 if (isatty(STDOUT_FILENO)) 164 { 165 tcgetattr(STDOUT_FILENO, &tt); 166 ioctl(STDOUT_FILENO, TIOCGWINSZ, &ws); 167 168 /* /dev/pts may not be available yet */ 169 if (openpty(&rc_logger_tty, &slave_tty, NULL, &tt, &ws)) 170 return; 171 } 172 else 173 /* /dev/pts may not be available yet */ 174 if (openpty(&rc_logger_tty, &slave_tty, NULL, NULL, NULL)) 175 return; 172 176 173 177 if ((s = fcntl(rc_logger_tty, F_GETFD, 0)) == 0) 174 178 fcntl(rc_logger_tty, F_SETFD, s | FD_CLOEXEC);