diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2012-11-08 15:57:47 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2012-11-08 15:59:06 +0000 |
commit | 2328886972a8525946787dc3d663a59484dae204 (patch) | |
tree | ce8be55934b229a774ea628e8fa7f7bb50a71e85 /main/openrc/rc-sys-lxc.patch | |
parent | 3a47d1a31dc1dc827cb803b18a557b4e59096b2b (diff) | |
download | aports-2328886972a8525946787dc3d663a59484dae204.tar.bz2 aports-2328886972a8525946787dc3d663a59484dae204.tar.xz |
main/openrc: fix lxc detection
Diffstat (limited to 'main/openrc/rc-sys-lxc.patch')
-rw-r--r-- | main/openrc/rc-sys-lxc.patch | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/main/openrc/rc-sys-lxc.patch b/main/openrc/rc-sys-lxc.patch new file mode 100644 index 0000000000..c693245d37 --- /dev/null +++ b/main/openrc/rc-sys-lxc.patch @@ -0,0 +1,39 @@ +diff --git a/src/librc/librc.c b/src/librc/librc.c +index d82880f..40b975a 100644 +--- a/src/librc/librc.c ++++ b/src/librc/librc.c +@@ -168,7 +168,7 @@ file_regex(const char *file, const char *regex) + char *line = NULL; + size_t len = 0; + regex_t re; +- bool retval = false; ++ bool retval = true; + int result; + + if (!(fp = fopen(file, "r"))) +@@ -184,11 +184,21 @@ file_regex(const char *file, const char *regex) + } + + while ((rc_getline(&line, &len, fp))) { +- if (regexec(&re, line, 0, NULL, 0) == 0) +- retval = true; +- if (retval) +- break; ++ char *str = line; ++ /* some /proc files have \0 separated content so we have to ++ loop through the 'line' */ ++ do { ++ if (regexec(&re, str, 0, NULL, 0) == 0) ++ goto found; ++ str += strlen(str) + 1; ++ /* len is the size of allocated buffer and we don't ++ want call regexec BUFSIZE times. find next str */ ++ while (*str == '\0' && str < line + len) ++ str++; ++ } while (str < line + len); + } ++ retval = false; ++found: + fclose(fp); + free(line); + regfree(&re); |