if (res != -1) {
close(res);
}
-
+
return (res != -1);
}
int i;
tty = get_cmdline_val("console", line, sizeof(line));
- split=strchr(tty, ',');
- if (split != NULL)
- split = '\0';
-
+ split = strchr(tty, ',');
+ if (split)
+ *split = '\0';
+
if (!dev_exist(tty)) {
DEBUG(4, "skipping %s\n", tty);
return;
close(fd);
sprintf( pattern, "%s=([^ \n]*)", name);
- regcomp(&pat_cmdline, pattern, REG_EXTENDED);
- if (!regexec(&pat_cmdline, line, 2, matches, 0)) {
- line[matches[1].rm_eo] = '\0';
+ regcomp(&pat_cmdline, pattern, REG_EXTENDED);
+ if (!regexec(&pat_cmdline, line, 2, matches, 0)) {
+ line[matches[1].rm_eo] = '\0';
tty = (line + matches[1].rm_so);
strncpy(out, tty, len);
tty[len-1] = '\0';
res = out;
}
- regfree(&pat_cmdline);
+ regfree(&pat_cmdline);
return res;
}