summaryrefslogtreecommitdiffhomepage
path: root/debianutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-04-29 23:38:12 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-04-29 23:38:12 +0000
commitd4728145e37dca844dded6f8723ef9fe7f9293b4 (patch)
tree0ab355a9fe4946a4312b6b1e1dbc968a447d15be /debianutils
parent08c8c1d3b33de1156d8a7030ba2797276b8ff351 (diff)
run_parts: do not check path portion of a name for "bad chars".
Needed for ifupdown. Patch by "Gabriel L. Somlo" <somlo@cmu.edu>
Diffstat (limited to 'debianutils')
-rw-r--r--debianutils/run_parts.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c
index eb2fb94b3..e6dec04bc 100644
--- a/debianutils/run_parts.c
+++ b/debianutils/run_parts.c
@@ -60,14 +60,17 @@ struct globals {
*/
static bool invalid_name(const char *c)
{
- while (*c) {
- if (!isalnum(*c) && (*c != '_') && (*c != '-' && (*c != '/'))) {
- return 1;
- }
- ++c;
- }
- return 0;
+ const char *base_name = strrchr(c, '/');
+
+ if (base_name)
+ c = base_name + 1;
+
+ while (*c && (isalnum(*c) || *c == '_' || *c == '-'))
+ c++;
+
+ return *c; /* TRUE (!0) if terminating NUL is not reached */
}
+
#define RUN_PARTS_OPT_a (1<<0)
#define RUN_PARTS_OPT_u (1<<1)
#define RUN_PARTS_OPT_t (1<<2)
@@ -81,6 +84,7 @@ static bool invalid_name(const char *c)
#else
#define list_mode (0)
#endif
+
static int act(const char *file, struct stat *statbuf, void *args, int depth)
{
int ret;