getty: fix regression introduced in
Replacing write() with dprint() without thinking leads to duplicate
output in getty.  In particular '\n login: foo login: ".
Must check if length is > 0, or dprint() will calculate it on its own.
@@ -71,6 +71,7 @@ static void do_parse(char *line, struct utsname *uts, char *tty)
s0 = line;
for (s = line; *s != 0; s++) {
if (*s == '\\') {
+ if ((s - s0) > 0)
dprint(STDOUT_FILENO, s0, s - s0);
s0 = s + 2;
switch (*++s) {
@@ -106,6 +107,7 @@ static void do_parse(char *line, struct utsname *uts, char *tty)
}
leave:
+ if ((s - s0) > 0)
dprint(STDOUT_FILENO, s0, s - s0);
}
