Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/gen/exect.c
- This file was added.
/* $NetBSD: exect.c,v 1.3 2018/01/17 01:24:29 kamil Exp $ */ | |||||
/*- | |||||
* Copyright (c) 2016 The NetBSD Foundation, Inc. | |||||
brooks: As you have now written the majority of code in this program, does it make more sense to put… | |||||
* All rights reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in the | |||||
* documentation and/or other materials provided with the distribution. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |||||
* POSSIBILITY OF SUCH DAMAGE. | |||||
*/ | |||||
#include <sys/cdefs.h> | |||||
__FBSDID("$FreeBSD$"); | |||||
#include <sys/ptrace.h> | |||||
#include <errno.h> | |||||
#include <unistd.h> | |||||
int | |||||
exect(const char *path, char *const argv[], char *const envp[]) | |||||
Not Done Inline ActionsThis doesn't tell the programmer who runs into this (someone with -Wl,--fatal-warnings set) anything useful. I wonder if it makes sense to add an example conversion to the manpage and refer to it. brooks: This doesn't tell the programmer who runs into this (someone with -Wl,--fatal-warnings set)… | |||||
{ | |||||
Done Inline ActionsWould it make sense to to call ptrace(PT_TRACE_ME,...); here or is the result not the same. Also, a weird style(9) nit. There should be a blank line between the (nonexistant) arguments and the return. brooks: Would it make sense to to call `ptrace(PT_TRACE_ME,...);` here or is the result not the same. | |||||
Not Done Inline ActionsThis was one of my suggestions on my email. It more closely matches the behavior of exect, except for the additional error cases. ali_mashtizadeh.com: This was one of my suggestions on my email. It more closely matches the behavior of exect… | |||||
if (ptrace(PT_TRACE_ME, 0, 0, 0) != 0) { | |||||
Done Inline ActionsAlso, return (execve());. kib: Also, `return (execve());`. | |||||
if (errno != EBUSY) | |||||
return (-1); | |||||
} | |||||
Done Inline ActionsMaybe ignore EBUSY here? brooks: Maybe ignore EBUSY here? | |||||
return (execve(path, argv, envp)); | |||||
} |
As you have now written the majority of code in this program, does it make more sense to put your copyright on it instead of TNF? It's not as though the calling of execve() could be anything else.