static int sysctl_act_recursive(const char *path)
{
- DIR *dirp;
struct stat buf;
- struct dirent *entry;
- char *next;
int retval = 0;
- stat(path, &buf);
- if (S_ISDIR(buf.st_mode) && !(option_mask32 & FLAG_WRITE)) {
+ if (!(option_mask32 & FLAG_WRITE)
+ && stat(path, &buf) == 0
+ && S_ISDIR(buf.st_mode)
+ ) {
+ struct dirent *entry;
+ DIR *dirp;
+
dirp = opendir(path);
if (dirp == NULL)
return -1;
while ((entry = readdir(dirp)) != NULL) {
- next = concat_subpath_file(path, entry->d_name);
+ char *next = concat_subpath_file(path, entry->d_name);
if (next == NULL)
continue; /* d_name is "." or ".." */
/* if path was ".", drop "./" prefix: */
return sysctl_act_recursive(".");
}
+//TODO: if(!argv[0]) bb_show_usage() ?
+
retval = 0;
while (*argv) {
sysctl_dots_to_slashes(*argv);