Nuke

Tito farmatito at tiscali.it
Sat Jun 20 15:10:24 UTC 2020



On 6/20/20 1:26 PM, Mike Davies wrote:
> So whos brilliant idea was it to select 'nuke' to be built by default ?
> 
> There is no documentation online for it.
> 
> You happen to type in nuke ..
> 
> and bye bye file system
> 
> Would it not be more sensible to disable it by default ?
> 
> 

Hi,

int nuke_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int nuke_main(int argc UNUSED_PARAM, char **argv)
{
// klibc-utils do not check opts, will try to delete "-dir" args
	//opt = getopt32(argv, "");
	//argv += optind;

	while (*++argv) {
#if 0
// klibc-utils do not check this, will happily operate on ".."
		const char *base = bb_get_last_path_component_strip(*argv);
		if (DOT_OR_DOTDOT(base)) {
			bb_error_msg("can't remove '.' or '..'");
			continue;
		}
#endif
		remove_file(*argv, FILEUTILS_FORCE | FILEUTILS_RECUR);
	}

// klibc-utils do not indicate errors
	return EXIT_SUCCESS;
}


I think that unless you specify some args on the commandline
nothing will be nuked.

Ciao,
Tito


More information about the busybox mailing list