svn commit: trunk/busybox: include util-linux

Vladimir N. Oleynik dzo at simtreas.ru
Tue Dec 13 08:55:56 UTC 2005


landley,

> +void find_dev(char *path)
> +{
> +	DIR *dir;
> +	int len=strlen(path);
> +
> +	if(!(dir = opendir(path)))
> +		bb_perror_msg_and_die("No %s",path);
> +
> +	for(;;) {
> +		struct dirent *entry = readdir(dir);
> +		
> +		if(!entry) break;
> +
> +		/* Skip "." and ".." (also skips hidden files, which is ok) */
> +
> +		if (entry->d_name[0]=='.') continue;
> +
> +		if (entry->d_type == DT_DIR) {
> +			snprintf(path+len, PATH_MAX-len, "/%s", entry->d_name);
> +			find_dev(path);
> +			path[len] = 0;

Its have bug: if second entry->d_type is shotred, this make rubbish path
variable after return from recursion.
Please use libbb/concat_subpath_file()


--w
vodz



More information about the busybox mailing list