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: <20150603103119.GF1828@krava.redhat.com>
Date:	Wed, 3 Jun 2015 12:31:19 +0200
From:	Jiri Olsa <jolsa@...hat.com>
To:	Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>
Cc:	mingo@...hat.com, ak@...ux.intel.com,
	Michael Ellerman <mpe@...erman.id.au>,
	Arnaldo Carvalho de Melo <acme@...nel.org>,
	namhyung@...nel.org, linuxppc-dev@...ts.ozlabs.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v13 02/14] perf, tools, jevents: Program to convert JSON
 file to C style file

On Tue, Jun 02, 2015 at 10:12:02AM -0700, Sukadev Bhattiprolu wrote:

SNIP

> + * If we fail to locate/process JSON and map files, create a NULL mapping
> + * table. This would at least allow perf to build even if we can't find/use
> + * the aliases.
> + */
> +static void create_empty_mapping(const char *output_file)
> +{
> +	FILE *outfp;
> +
> +	pr_info("%s: Creating empty pmu_events_map[] table\n", prog);
> +
> +	/* Unlink file to clear any partial writes to it */
> +	unlink(output_file);
> +
> +	outfp = fopen(output_file, "a");

you could open with "w+" and save the unlink call

SNIP

> +int main(int argc, char *argv[])
> +{
> +	int rc;
> +	int flags;
> +	int maxfds;
> +	char dirname[PATH_MAX];
> +
> +	const char *arch;
> +	const char *output_file;
> +	const char *start_dirname;
> +
> +	prog = basename(argv[0]);
> +	if (argc < 4) {
> +		pr_err("Usage: %s <arch> <starting_dir> <output_file>\n", prog);
> +		return 1;
> +	}
> +
> +	arch = argv[1];
> +	start_dirname = argv[2];
> +	output_file = argv[3];
> +
> +	if (argc > 4)
> +		verbose = atoi(argv[4]);
> +
> +	unlink(output_file);
> +	eventsfp = fopen(output_file, "a");

ditto

SNIP
--
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