mescc: Mes C Library: Fix execlp, execvp for file names with slash.
Reported by mid-kid. * lib/posix/execlp.c (execlp): Do not use search_path when file name contains a slash (WAS: when file name starts with slash). * lib/posix/execvp.c (execvp): Likewise.
This commit is contained in:
parent
62193aa1db
commit
d8fca8321e
|
@ -21,6 +21,7 @@
|
||||||
#include <mes/lib.h>
|
#include <mes/lib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
execlp (char const *file_name, char const *arg, ...)
|
execlp (char const *file_name, char const *arg, ...)
|
||||||
|
@ -28,7 +29,7 @@ execlp (char const *file_name, char const *arg, ...)
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int r;
|
int r;
|
||||||
va_start (ap, arg);
|
va_start (ap, arg);
|
||||||
if (file_name[0] != '/')
|
if (!strchr (file_name, '/'))
|
||||||
file_name = search_path (file_name);
|
file_name = search_path (file_name);
|
||||||
if (__mes_debug () > 2)
|
if (__mes_debug () > 2)
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,12 +20,13 @@
|
||||||
|
|
||||||
#include <mes/lib.h>
|
#include <mes/lib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int
|
int
|
||||||
execvp (char const *file_name, char *const argv[])
|
execvp (char const *file_name, char *const argv[])
|
||||||
{
|
{
|
||||||
if (file_name[0] != '/')
|
if (!strchr (file_name, '/'))
|
||||||
file_name = search_path (file_name);
|
file_name = search_path (file_name);
|
||||||
if (!file_name)
|
if (!file_name)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue