[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [lvm-devel] LVM2/test Makefile.in test-utils.sh not.c



Err.

mornfall sourceware org writes:
> +	pid = fork();
> +	if (pid == -1) {
> +		fprintf(stderr, "Could not fork\n");
> +		return FAILURE;
> +	} else if (pid == 0) { 	/* child */
> +		execvp(argv[1], &argv[1]);
> +		/* should not be accessible */
> +		return FAILURE;
This should probably be return SUCCESS or abort() I guess. This will turn
command not found and other unexpected failures to overall not failures (these
are treated as successes, thanks to the parent's reinterpretation of exit
code). (This still ain't a regression, I believe, though.) Opinions?

> +	} else {		/* parent */
> +		waitpid(pid, &status, 0);
> +		if (!WIFEXITED(status)) {
> +			/* did not exit correctly */
> +			return FAILURE;
> +		}
> +		/* return the opposite */
> +		return !WEXITSTATUS(status);
> +	}
> +	/* not accessible */
> +	return FAILURE;

Yours,
   Petr.

--
Peter Rockai | me()mornfall!net | prockai()redhat!com
 http://blog.mornfall.net | http://web.mornfall.net

"In My Egotistical Opinion, most people's C programs should be
 indented six feet downward and covered with dirt."
     -- Blair P. Houghton on the subject of C program indentation


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]