mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Added the POSIX exec() family functions, based upon code contributed
by Henning Nielsen Lund. Thank you very much! - atoll() no longer sets 'errno' directly but now calls __set_errno() instead. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15116 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $Id: GNUmakefile.68k,v 1.91 2006-08-01 17:01:13 obarthel Exp $
|
# $Id: GNUmakefile.68k,v 1.92 2006-08-02 08:00:27 obarthel Exp $
|
||||||
#
|
#
|
||||||
# :ts=8
|
# :ts=8
|
||||||
#
|
#
|
||||||
@@ -529,11 +529,14 @@ UNIX_LIB = \
|
|||||||
unistd_common_pathconf.o \
|
unistd_common_pathconf.o \
|
||||||
unistd_def_path.o \
|
unistd_def_path.o \
|
||||||
unistd_def_path_delimiter.o \
|
unistd_def_path_delimiter.o \
|
||||||
|
unistd_environ.o \
|
||||||
unistd_execl.o \
|
unistd_execl.o \
|
||||||
unistd_execle.o \
|
unistd_execle.o \
|
||||||
unistd_execlp.o \
|
unistd_execlp.o \
|
||||||
unistd_execv.o \
|
unistd_execv.o \
|
||||||
unistd_execve.o \
|
unistd_execve.o \
|
||||||
|
unistd_execve_env_exit.o \
|
||||||
|
unistd_execve_env_init.o \
|
||||||
unistd_execvp.o \
|
unistd_execvp.o \
|
||||||
unistd_fpathconf.o \
|
unistd_fpathconf.o \
|
||||||
unistd_getcwd.o \
|
unistd_getcwd.o \
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $Id: GNUmakefile.os4,v 1.104 2006-08-01 17:01:13 obarthel Exp $
|
# $Id: GNUmakefile.os4,v 1.105 2006-08-02 08:00:27 obarthel Exp $
|
||||||
#
|
#
|
||||||
# :ts=8
|
# :ts=8
|
||||||
#
|
#
|
||||||
@@ -572,11 +572,14 @@ UNIX_LIB = \
|
|||||||
unistd_common_pathconf.o \
|
unistd_common_pathconf.o \
|
||||||
unistd_def_path.o \
|
unistd_def_path.o \
|
||||||
unistd_def_path_delimiter.o \
|
unistd_def_path_delimiter.o \
|
||||||
|
unistd_environ.o \
|
||||||
unistd_execl.o \
|
unistd_execl.o \
|
||||||
unistd_execle.o \
|
unistd_execle.o \
|
||||||
unistd_execlp.o \
|
unistd_execlp.o \
|
||||||
unistd_execv.o \
|
unistd_execv.o \
|
||||||
unistd_execve.o \
|
unistd_execve.o \
|
||||||
|
unistd_execve_env_exit.o \
|
||||||
|
unistd_execve_env_init.o \
|
||||||
unistd_execvp.o \
|
unistd_execvp.o \
|
||||||
unistd_fpathconf.o \
|
unistd_fpathconf.o \
|
||||||
unistd_getcwd.o \
|
unistd_getcwd.o \
|
||||||
|
|||||||
@@ -1,3 +1,9 @@
|
|||||||
|
- Added the POSIX exec() family functions, based upon code contributed
|
||||||
|
by Henning Nielsen Lund. Thank you very much!
|
||||||
|
|
||||||
|
- atoll() no longer sets 'errno' directly but now calls __set_errno()
|
||||||
|
instead.
|
||||||
|
|
||||||
- Added pathconf(), fpathconf(), sysinfo(), ftime(), ulimit(), getrlimit()
|
- Added pathconf(), fpathconf(), sysinfo(), ftime(), ulimit(), getrlimit()
|
||||||
and setrlimit() as contributed by Peter Bengtsson. Thank you very much!
|
and setrlimit() as contributed by Peter Bengtsson. Thank you very much!
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: dos.h,v 1.22 2006-08-01 19:06:48 obarthel Exp $
|
* $Id: dos.h,v 1.23 2006-08-02 08:00:30 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -499,6 +499,34 @@ extern char * __default_path;
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 'environ' is the default environment variable table as used by the execl(),
|
||||||
|
* execv() and execvp() functions. This needs to be initialized before you
|
||||||
|
* can use it. The table has the following form:
|
||||||
|
*
|
||||||
|
* char ** environ =
|
||||||
|
* {
|
||||||
|
* "variable1=value",
|
||||||
|
* "variable2=value",
|
||||||
|
* NULL
|
||||||
|
* };
|
||||||
|
*
|
||||||
|
* Note that if you initialize the 'environ' table you will also have to
|
||||||
|
* provide for a function which prepares its contents in execve() for use
|
||||||
|
* by the command to be executed. That function is called
|
||||||
|
* __execve_environ_init(). Should program execution fail, you need to
|
||||||
|
* clean up after what __execve_environ_init() set up. To do this, call
|
||||||
|
* __execve_environ_exit(). There are stubs in clib2 for these functions
|
||||||
|
* which essentially do nothing at all. You will have to implement these
|
||||||
|
* yourself if you want to use them.
|
||||||
|
*/
|
||||||
|
extern char ** environ;
|
||||||
|
|
||||||
|
extern int __execve_environ_init(char * const envp[]);
|
||||||
|
extern void __execve_environ_exit(char * const envp[]);
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: stdlib_atoll.c,v 1.2 2006-01-08 12:04:25 obarthel Exp $
|
* $Id: stdlib_atoll.c,v 1.3 2006-08-02 08:00:27 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -58,7 +58,7 @@ atoll(const char *str)
|
|||||||
{
|
{
|
||||||
if(str == NULL)
|
if(str == NULL)
|
||||||
{
|
{
|
||||||
errno = EFAULT;
|
__set_errno(EFAULT);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
40
library/unistd_environ.c
Normal file
40
library/unistd_environ.c
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* $Id: unistd_environ.c,v 1.1 2006-08-02 08:00:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||||
|
* may be used to endorse or promote products derived from this
|
||||||
|
* software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UNISTD_HEADERS_H
|
||||||
|
#include "unistd_headers.h"
|
||||||
|
#endif /* _UNISTD_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
char ** environ;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: unistd_execl.c,v 1.2 2006-08-02 06:49:47 obarthel Exp $
|
* $Id: unistd_execl.c,v 1.3 2006-08-02 08:00:27 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -87,7 +87,7 @@ execl(const char *path, const char *arg0, ...)
|
|||||||
|
|
||||||
argv[argc] = NULL;
|
argv[argc] = NULL;
|
||||||
|
|
||||||
result = execve(path,(char * const *)argv, NULL /*environ*/ );
|
result = execve(path,(char * const *)argv,environ);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: unistd_execv.c,v 1.2 2006-08-01 17:01:13 obarthel Exp $
|
* $Id: unistd_execv.c,v 1.3 2006-08-02 08:00:27 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -46,7 +46,7 @@ execv(const char *path,char * const argv[])
|
|||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
result = execve(path,argv,NULL /*environ*/);
|
result = execve(path,argv,environ);
|
||||||
|
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: unistd_execve.c,v 1.3 2006-08-02 06:49:47 obarthel Exp $
|
* $Id: unistd_execve.c,v 1.4 2006-08-02 08:00:27 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -302,7 +302,6 @@ find_command(const char * path,struct program_info ** result_ptr)
|
|||||||
dvp = GetDeviceProc((STRPTR)path,dvp);
|
dvp = GetDeviceProc((STRPTR)path,dvp);
|
||||||
if(dvp != NULL)
|
if(dvp != NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
SetFileSysTask(dvp->dvp_Port);
|
SetFileSysTask(dvp->dvp_Port);
|
||||||
|
|
||||||
old_dir = CurrentDir(dvp->dvp_Lock);
|
old_dir = CurrentDir(dvp->dvp_Lock);
|
||||||
@@ -593,6 +592,18 @@ build_arg_string(char *const argv[],char * arg_string)
|
|||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* NOTE: This is not an execve() function which works like you might expect it
|
||||||
|
to do on a Unix-like system. Specifically, the command which will
|
||||||
|
be executed does not replace the currently running program. That
|
||||||
|
command will be executed first, and when it has returned the currently
|
||||||
|
running program will exit. Also, if you need to redirect the standard
|
||||||
|
input/output/error streams you will have to do this using the
|
||||||
|
equivalent AmigaDOS functions (Open, SelectInput(), SelectOutput()
|
||||||
|
and SelectErrorOutput()), restoring these streams before your program
|
||||||
|
exits. What this execve() function does is very similar to how the
|
||||||
|
built-in AmigaDOS shell works, but it is much more limited in what
|
||||||
|
it can do. */
|
||||||
|
|
||||||
int
|
int
|
||||||
execve(const char *path, char *const argv[], char *const envp[])
|
execve(const char *path, char *const argv[], char *const envp[])
|
||||||
{
|
{
|
||||||
@@ -604,6 +615,7 @@ execve(const char *path, char *const argv[], char *const envp[])
|
|||||||
size_t arg_string_len = 0;
|
size_t arg_string_len = 0;
|
||||||
size_t parameter_string_len;
|
size_t parameter_string_len;
|
||||||
BOOL success = FALSE;
|
BOOL success = FALSE;
|
||||||
|
BOOL clean_up_env = FALSE;
|
||||||
BPTR old_dir;
|
BPTR old_dir;
|
||||||
LONG rc;
|
LONG rc;
|
||||||
|
|
||||||
@@ -689,6 +701,16 @@ execve(const char *path, char *const argv[], char *const envp[])
|
|||||||
arg_string[arg_string_len++] = '\n';
|
arg_string[arg_string_len++] = '\n';
|
||||||
arg_string[arg_string_len] = '\0';
|
arg_string[arg_string_len] = '\0';
|
||||||
|
|
||||||
|
/* Almost ready: prepare the environment data so that it can
|
||||||
|
be used by the command to be executed. */
|
||||||
|
if(envp != NULL)
|
||||||
|
{
|
||||||
|
if(__execve_environ_init(envp) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
clean_up_env = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Change the shell's program name */
|
/* Change the shell's program name */
|
||||||
GetProgramName(old_program_name,sizeof(old_program_name));
|
GetProgramName(old_program_name,sizeof(old_program_name));
|
||||||
SetProgramName(pi->program_name);
|
SetProgramName(pi->program_name);
|
||||||
@@ -723,16 +745,19 @@ execve(const char *path, char *const argv[], char *const envp[])
|
|||||||
out:
|
out:
|
||||||
|
|
||||||
/* Clean up... */
|
/* Clean up... */
|
||||||
|
if(clean_up_env)
|
||||||
|
__execve_environ_exit(envp);
|
||||||
|
|
||||||
|
/* If things went well, we can actually quit now. */
|
||||||
|
if(success)
|
||||||
|
exit(result);
|
||||||
|
|
||||||
if(pi != NULL)
|
if(pi != NULL)
|
||||||
free_program_info(pi);
|
free_program_info(pi);
|
||||||
|
|
||||||
if(arg_string != NULL)
|
if(arg_string != NULL)
|
||||||
free(arg_string);
|
free(arg_string);
|
||||||
|
|
||||||
/* If things went well, we can actually quit now. */
|
|
||||||
if(success)
|
|
||||||
exit(result);
|
|
||||||
|
|
||||||
/* This function only returns control to the caller
|
/* This function only returns control to the caller
|
||||||
if something went wrong... */
|
if something went wrong... */
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|||||||
47
library/unistd_execve_env_exit.c
Normal file
47
library/unistd_execve_env_exit.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* $Id: unistd_execve_env_exit.c,v 1.1 2006-08-02 08:00:27 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||||
|
* may be used to endorse or promote products derived from this
|
||||||
|
* software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UNISTD_HEADERS_H
|
||||||
|
#include "unistd_headers.h"
|
||||||
|
#endif /* _UNISTD_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* This is a stub which you need override with your own implementation. The
|
||||||
|
Function expects a non-NULL pointer to an environment table and will
|
||||||
|
do whatever is necessary to clean up after what a previous call to the
|
||||||
|
__execve_environ_init() function did. */
|
||||||
|
void
|
||||||
|
__execve_environ_exit(char * const envp[])
|
||||||
|
{
|
||||||
|
}
|
||||||
49
library/unistd_execve_env_init.c
Normal file
49
library/unistd_execve_env_init.c
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/*
|
||||||
|
* $Id: unistd_execve_env_init.c,v 1.1 2006-08-02 08:00:28 obarthel Exp $
|
||||||
|
*
|
||||||
|
* :ts=4
|
||||||
|
*
|
||||||
|
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||||
|
* Copyright (c) 2002-2006 by Olaf Barthel <olsen (at) sourcery.han.de>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* - Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||||
|
* may be used to endorse or promote products derived from this
|
||||||
|
* software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UNISTD_HEADERS_H
|
||||||
|
#include "unistd_headers.h"
|
||||||
|
#endif /* _UNISTD_HEADERS_H */
|
||||||
|
|
||||||
|
/****************************************************************************/
|
||||||
|
|
||||||
|
/* This is a stub which you need override with your own implementation. The
|
||||||
|
Function expects a non-NULL pointer to an environment table and will
|
||||||
|
do whatever is necessary to prepare a subsequent call to RunCommand()
|
||||||
|
to use the environment data. If your function succeeds, return 0 and
|
||||||
|
a negative value if it fails. */
|
||||||
|
int
|
||||||
|
__execve_environ_init(char * const envp[])
|
||||||
|
{
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: unistd_execvp.c,v 1.3 2006-08-02 06:49:47 obarthel Exp $
|
* $Id: unistd_execvp.c,v 1.4 2006-08-02 08:00:29 obarthel Exp $
|
||||||
*
|
*
|
||||||
* :ts=4
|
* :ts=4
|
||||||
*
|
*
|
||||||
@@ -109,7 +109,7 @@ execvp(const char *command,char * const argv[])
|
|||||||
/* If it's an absolute or relative path name, it's easy. */
|
/* If it's an absolute or relative path name, it's easy. */
|
||||||
if(strchr(command,'/') != NULL || strchr(command,':') != NULL)
|
if(strchr(command,'/') != NULL || strchr(command,':') != NULL)
|
||||||
{
|
{
|
||||||
result = execve(command, argv, NULL /*environ*/);
|
result = execve(command, argv, environ);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -177,7 +177,7 @@ execvp(const char *command,char * const argv[])
|
|||||||
command_buffer[complete_path_len] = '\0';
|
command_buffer[complete_path_len] = '\0';
|
||||||
|
|
||||||
/* Now try to run that command. */
|
/* Now try to run that command. */
|
||||||
result = execve(command_buffer, argv, NULL /*environ*/);
|
result = execve(command_buffer, argv, environ);
|
||||||
|
|
||||||
/* Did it work? And if it didn't work, did it fail because
|
/* Did it work? And if it didn't work, did it fail because
|
||||||
the command to be run could not be executed? */
|
the command to be run could not be executed? */
|
||||||
|
|||||||
Reference in New Issue
Block a user