Loading init/devices.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -451,6 +451,8 @@ static char **parse_platform_block_device(struct uevent *uevent) if (uevent->partition_name) { if (uevent->partition_name) { p = strdup(uevent->partition_name); p = strdup(uevent->partition_name); sanitize(p); sanitize(p); if (strcmp(uevent->partition_name, p)) NOTICE("Linking partition '%s' as '%s'\n", uevent->partition_name, p); if (asprintf(&links[link_num], "%s/by-name/%s", link_path, p) > 0) if (asprintf(&links[link_num], "%s/by-name/%s", link_path, p) > 0) link_num++; link_num++; else else Loading init/util.c +16 −3 Original line number Original line Diff line number Diff line Loading @@ -305,14 +305,27 @@ int mkdir_recursive(const char *pathname, mode_t mode) return 0; return 0; } } /* * replaces any unacceptable characters with '_', the * length of the resulting string is equal to the input string */ void sanitize(char *s) void sanitize(char *s) { { const char* accept = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "_-."; if (!s) if (!s) return; return; while (isalnum(*s)) s++; for (; *s; s++) { *s = 0; s += strspn(s, accept); if (*s) *s = '_'; } } } void make_link(const char *oldpath, const char *newpath) void make_link(const char *oldpath, const char *newpath) { { int ret; int ret; Loading Loading
init/devices.c +2 −0 Original line number Original line Diff line number Diff line Loading @@ -451,6 +451,8 @@ static char **parse_platform_block_device(struct uevent *uevent) if (uevent->partition_name) { if (uevent->partition_name) { p = strdup(uevent->partition_name); p = strdup(uevent->partition_name); sanitize(p); sanitize(p); if (strcmp(uevent->partition_name, p)) NOTICE("Linking partition '%s' as '%s'\n", uevent->partition_name, p); if (asprintf(&links[link_num], "%s/by-name/%s", link_path, p) > 0) if (asprintf(&links[link_num], "%s/by-name/%s", link_path, p) > 0) link_num++; link_num++; else else Loading
init/util.c +16 −3 Original line number Original line Diff line number Diff line Loading @@ -305,14 +305,27 @@ int mkdir_recursive(const char *pathname, mode_t mode) return 0; return 0; } } /* * replaces any unacceptable characters with '_', the * length of the resulting string is equal to the input string */ void sanitize(char *s) void sanitize(char *s) { { const char* accept = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789" "_-."; if (!s) if (!s) return; return; while (isalnum(*s)) s++; for (; *s; s++) { *s = 0; s += strspn(s, accept); if (*s) *s = '_'; } } } void make_link(const char *oldpath, const char *newpath) void make_link(const char *oldpath, const char *newpath) { { int ret; int ret; Loading