chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] remove sleeps from udev as it is external now
[elogind.git]
/
udev_config.c
diff --git
a/udev_config.c
b/udev_config.c
index 19f690c7e8cd0d77d703b7adfcec3fcebb534db6..ae755f39fde82515b563d3892e750396227a7209 100644
(file)
--- a/
udev_config.c
+++ b/
udev_config.c
@@
-50,7
+50,6
@@
char default_mode_str[MODE_SIZE];
char default_owner_str[OWNER_SIZE];
char default_group_str[GROUP_SIZE];
int udev_log;
char default_owner_str[OWNER_SIZE];
char default_group_str[GROUP_SIZE];
int udev_log;
-int udev_sleep;
int udev_dev_d;
int udev_dev_d;
@@
-79,11
+78,6
@@
static void init_variables(void)
strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE);
udev_log = string_is_true(UDEV_LOG_DEFAULT);
strfieldcpy(udev_permissions_filename, UDEV_PERMISSION_FILE);
udev_log = string_is_true(UDEV_LOG_DEFAULT);
- udev_sleep = 1;
- env = getenv("UDEV_NO_SLEEP");
- if (env && string_is_true(env))
- udev_sleep = 0;
-
udev_dev_d = 1;
env = getenv("UDEV_NO_DEVD");
if (env && string_is_true(env))
udev_dev_d = 1;
env = getenv("UDEV_NO_DEVD");
if (env && string_is_true(env))
@@
-127,7
+121,8
@@
int parse_get_pair(char **orig_string, char **left, char **right)
static int parse_config_file(void)
{
static int parse_config_file(void)
{
- char line[255];
+ char line[LINE_SIZE];
+ char *bufline;
char *temp;
char *variable;
char *value;
char *temp;
char *variable;
char *value;
@@
-148,32
+143,35
@@
static int parse_config_file(void)
/* loop through the whole file */
lineno = 0;
cur = 0;
/* loop through the whole file */
lineno = 0;
cur = 0;
- while (
1
) {
+ while (
cur < bufsize
) {
count = buf_get_line(buf, bufsize, cur);
count = buf_get_line(buf, bufsize, cur);
-
- strncpy(line, buf + cur, count);
- line[count] = '\0';
- temp = line;
- lineno++;
-
+ bufline = &buf[cur];
cur += count+1;
cur += count+1;
- if (cur > bufsize)
- break;
-
- dbg_parse("read '%s'", temp);
+ lineno++;
- /* eat the whitespace at the beginning of the line */
- while (isspace(*temp))
- ++temp;
+ if (count >= LINE_SIZE) {
+ info("line too long, conf line skipped %s, line %d",
+ udev_config_filename, lineno);
+ continue;
+ }
- /* empty line? */
- if (*temp == 0x00)
+ /* eat the whitespace */
+ while ((count > 0) && isspace(bufline[0])) {
+ bufline++;
+ count--;
+ }
+ if (count == 0)
continue;
/* see if this is a comment */
continue;
/* see if this is a comment */
- if (
*temp
== COMMENT_CHARACTER)
+ if (
bufline[0]
== COMMENT_CHARACTER)
continue;
continue;
+ strncpy(line, bufline, count);
+ line[count] = '\0';
+ temp = line;
+ dbg_parse("read '%s'", temp);
+
retval = parse_get_pair(&temp, &variable, &value);
if (retval != 0)
info("%s:%d:%Zd: error parsing '%s'",
retval = parse_get_pair(&temp, &variable, &value);
if (retval != 0)
info("%s:%d:%Zd: error parsing '%s'",