Merge "Make ueventd error messages indicate where the error is in ueventd script"
This commit is contained in:
commit
fd72bbe91f
3 changed files with 8 additions and 8 deletions
|
@ -94,7 +94,7 @@ int ueventd_main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void set_device_permission(int nargs, char **args)
|
||||
void set_device_permission(const char* fn, int line, int nargs, char **args)
|
||||
{
|
||||
char *name;
|
||||
char *attr = 0;
|
||||
|
@ -121,7 +121,7 @@ void set_device_permission(int nargs, char **args)
|
|||
}
|
||||
|
||||
if (nargs != 4) {
|
||||
LOG(ERROR) << "invalid line ueventd.rc line for '" << args[0] << "'";
|
||||
LOG(ERROR) << "invalid line (" << fn << ":" << line << ") line for '" << args[0] << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -136,20 +136,20 @@ void set_device_permission(int nargs, char **args)
|
|||
|
||||
perm = strtol(args[1], &endptr, 8);
|
||||
if (!endptr || *endptr != '\0') {
|
||||
LOG(ERROR) << "invalid mode '" << args[1] << "'";
|
||||
LOG(ERROR) << "invalid mode (" << fn << ":" << line << ") '" << args[1] << "'";
|
||||
return;
|
||||
}
|
||||
|
||||
struct passwd* pwd = getpwnam(args[2]);
|
||||
if (!pwd) {
|
||||
LOG(ERROR) << "invalid uid '" << args[2] << "'";
|
||||
LOG(ERROR) << "invalid uid (" << fn << ":" << line << ") '" << args[2] << "'";
|
||||
return;
|
||||
}
|
||||
uid = pwd->pw_uid;
|
||||
|
||||
struct group* grp = getgrnam(args[3]);
|
||||
if (!grp) {
|
||||
LOG(ERROR) << "invalid gid '" << args[3] << "'";
|
||||
LOG(ERROR) << "invalid gid (" << fn << ":" << line << ") '" << args[3] << "'";
|
||||
return;
|
||||
}
|
||||
gid = grp->gr_gid;
|
||||
|
|
|
@ -236,6 +236,6 @@ int ueventd_parse_config_file(const char *fn)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void parse_line_device(parse_state*, int nargs, char** args) {
|
||||
set_device_permission(nargs, args);
|
||||
static void parse_line_device(parse_state* state, int nargs, char** args) {
|
||||
set_device_permission(state->filename, state->line, nargs, args);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#define UEVENTD_PARSER_MAXARGS 5
|
||||
|
||||
int ueventd_parse_config_file(const char *fn);
|
||||
void set_device_permission(int nargs, char **args);
|
||||
void set_device_permission(const char* fn, int line, int nargs, char **args);
|
||||
struct ueventd_subsystem *ueventd_subsystem_find_by_name(const char *name);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue