lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080506035108.GD24008@flower.upol.cz>
Date:	Tue, 6 May 2008 05:51:08 +0200
From:	Oleg Verych <olecom@...wer.upol.cz>
To:	Sam Ravnborg <sam@...nborg.org>
Cc:	Ingo Molnar <mingo@...e.hu>, Sergio Luis <sergio@...e.br>,
	Parag Warudkar <parag.warudkar@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	"akpm@...l.org" <akpm@...l.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Arjan van de Ven <arjan@...radead.org>,
	Dave Jones <davej@...hat.com>,
	linux-kbuild <linux-kbuild@...r.kernel.org>
Subject: Re: [PATCH] kconfig: add support for stdin (make K=- ...)

Sam Ravnborg @ Mon, May 05, 2008 at 09:49:29PM +0200:
[]
> > i think the 'natural' script behavior would be for this to do the right 
> > thing:
> > 
> >    zcat /proc/config.gz | make K=- alldefconfig
> > 
> > or something like that - so that it can be scripted in a pipe.
> 
> I like this ;-)
> So I implemented support for stdin - see attached.
> It is also in kbuild.git.

Isn't /dev/stdin (or link to /proc) supported everywhere already?

> +	if (strcmp(config_file, "-")) {

full strcmp() for just one symbol?

> +		if (config_file && stat(config_file, &tmpstat)) {
> +			fprintf(stderr, _("%s: failed to open %s\n"),
> +			        av[0], config_file);
> +			exit(1);
> +		}
> +		config_filename = config_file;
> +	} else {
> +		config_filename = "stdin";
>  	}
> +
>  	if (config_file && conf_read_simple(config_file, S_DEF_USER)) {
>  		fprintf(stderr, _("%s: failed to read %s\n"),
> -		        av[0], config_file);
> +		        av[0], config_filename);
>  		exit(1);
>  	}
>  	if (config_file) {
>  		printf("#\n");
> -		printf(_("# configuration is based on '%s'\n"), config_file);
> +		printf(_("# configuration is based on '%s'\n"),
> +		       config_filename);
>  	}
>  	/* generate the config */
>  	do {
> diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
> index 6a61cee..7bd00d3 100644
> --- a/scripts/kconfig/lex.zconf.c_shipped
> +++ b/scripts/kconfig/lex.zconf.c_shipped
> @@ -2268,13 +2268,17 @@ FILE *zconf_fopen(const char *name)
>  	char *env, fullname[PATH_MAX+1];
>  	FILE *f;
>  
> -	f = fopen(name, "r");
> -	if (!f && name != NULL && name[0] != '/') {
> -		env = getenv(SRCTREE);
> -		if (env) {
> -			sprintf(fullname, "%s/%s", env, name);
> -			f = fopen(fullname, "r");
> +	if (strcmp(name, "-")) {
> +		f = fopen(name, "r");
> +		if (!f && name != NULL && name[0] != '/') {
> +			env = getenv(SRCTREE);
> +			if (env) {
> +				sprintf(fullname, "%s/%s", env, name);
> +				f = fopen(fullname, "r");
> +			}
>  		}
> +	} else {
> +		f = stdin;
>  	}
>  	return f;
>  }
> diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
> index 4cea5c8..a268d88 100644
> --- a/scripts/kconfig/zconf.l
> +++ b/scripts/kconfig/zconf.l
> @@ -269,13 +269,17 @@ FILE *zconf_fopen(const char *name)
>  	char *env, fullname[PATH_MAX+1];
>  	FILE *f;
>  
> -	f = fopen(name, "r");
> -	if (!f && name != NULL && name[0] != '/') {
> -		env = getenv(SRCTREE);
> -		if (env) {
> -			sprintf(fullname, "%s/%s", env, name);
> -			f = fopen(fullname, "r");
> +	if (strcmp(name, "-")) {
> +		f = fopen(name, "r");
> +		if (!f && name != NULL && name[0] != '/') {
> +			env = getenv(SRCTREE);
> +			if (env) {
> +				sprintf(fullname, "%s/%s", env, name);
> +				f = fopen(fullname, "r");
> +			}
>  		}
> +	} else {
> +		f = stdin;
>  	}
>  	return f;

rather big diffstat for almost nothing. Userspacy?
____
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ