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:
Jan Nieuwenhuizen 2019-12-29 14:25:40 +01:00
parent 62193aa1db
commit d8fca8321e
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
2 changed files with 4 additions and 2 deletions

View File

@ -21,6 +21,7 @@
#include <mes/lib.h>
#include <errno.h>
#include <stdarg.h>
#include <string.h>
int
execlp (char const *file_name, char const *arg, ...)
@ -28,7 +29,7 @@ execlp (char const *file_name, char const *arg, ...)
va_list ap;
int r;
va_start (ap, arg);
if (file_name[0] != '/')
if (!strchr (file_name, '/'))
file_name = search_path (file_name);
if (__mes_debug () > 2)
{

View File

@ -20,12 +20,13 @@
#include <mes/lib.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
int
execvp (char const *file_name, char *const argv[])
{
if (file_name[0] != '/')
if (!strchr (file_name, '/'))
file_name = search_path (file_name);
if (!file_name)
{