run_parts: do not check path portion of a name for "bad chars".

Needed for ifupdown. Patch by "Gabriel L. Somlo" <somlo@cmu.edu>
This commit is contained in:
Denis Vlasenko 2007-04-29 23:38:12 +00:00
parent 08c8c1d3b3
commit d4728145e3

View File

@ -60,14 +60,17 @@ struct globals {
*/ */
static bool invalid_name(const char *c) static bool invalid_name(const char *c)
{ {
while (*c) { const char *base_name = strrchr(c, '/');
if (!isalnum(*c) && (*c != '_') && (*c != '-' && (*c != '/'))) {
return 1; if (base_name)
} c = base_name + 1;
++c;
} while (*c && (isalnum(*c) || *c == '_' || *c == '-'))
return 0; c++;
return *c; /* TRUE (!0) if terminating NUL is not reached */
} }
#define RUN_PARTS_OPT_a (1<<0) #define RUN_PARTS_OPT_a (1<<0)
#define RUN_PARTS_OPT_u (1<<1) #define RUN_PARTS_OPT_u (1<<1)
#define RUN_PARTS_OPT_t (1<<2) #define RUN_PARTS_OPT_t (1<<2)
@ -81,6 +84,7 @@ static bool invalid_name(const char *c)
#else #else
#define list_mode (0) #define list_mode (0)
#endif #endif
static int act(const char *file, struct stat *statbuf, void *args, int depth) static int act(const char *file, struct stat *statbuf, void *args, int depth)
{ {
int ret; int ret;