From cfb39b573f63349c26faa2168790a84e0ae66e9f Mon Sep 17 00:00:00 2001 From: Jesse Smith Date: Mon, 23 Apr 2018 00:09:49 -0300 Subject: [PATCH] Updated init.c to remove some old notes and answer questions that were flagged in comments or FIXME labels. --- doc/Changelog | 2 ++ src/init.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index f39fcfb..05903f9 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,8 @@ sysvinit (2.90) UNRELEASED; urgency=low [ Jesse Smith ] + * Updated some comments in init.c to answer questions or + remove old notes we no longer need. * Removed unneeded "count" variable in utmpdump.c. * Fixed typo in accidental wrote_wtmp_rlevel == 0 || wrote_wtmp_rlevel comparison so the latter is wrote_utmp_rlevel. diff --git a/src/init.c b/src/init.c index a3e0276..3d78b32 100644 --- a/src/init.c +++ b/src/init.c @@ -308,7 +308,13 @@ void send_state(int fd) /* * Read a string from a file descriptor. - * FIXME: why not use fgets() ? + * Q: why not use fgets() ? + * A: Answer: looked into this. Turns out after all the checks + * required in the fgets() approach (removing newline, read errors, etc) + * the function is longer and takes approximately the same amount of + * time to do one big fgets and checks as it does to do a pile of getcs. + * We don't benefit from switching. + * - Jesse */ static int get_string(char *p, int size, FILE *f) { @@ -1241,7 +1247,7 @@ pid_t spawn(CHILD *ch, int *res) * and expects utmp to be updated already! * * Do NOT log if process field starts with '+' - * FIXME: that's for compatibility with *very* + * This is for compatibility with *very* * old getties - probably it can be taken out. */ if (ch->process[0] != '+') @@ -1810,7 +1816,7 @@ void start_if_needed(void) } if (delete) { - /* FIXME: is this OK? */ + /* is this OK? */ ch->flags &= ~(RUNNING|WAITING); if (!ISPOWER(ch->action) && ch->action != KBREQUEST) ch->flags &= ~XECUTED; @@ -2335,12 +2341,6 @@ void initcmd_setenv(char *data, int size) /* * Read from the init FIFO. Processes like telnetd and rlogind can * ask us to create login processes on their behalf. - * - * FIXME: this needs to be finished. NOT that it is buggy, but we need - * to add the telnetd/rlogind stuff so people can start using it. - * Maybe move to using an AF_UNIX socket so we can use - * the 2.2 kernel credential stuff to see who we're talking to. - * */ static void check_init_fifo(void)