Make test report EXEC files (shell scripts) as executable.

This commit is contained in:
Stephen Heumann 2014-12-04 13:41:21 -06:00
parent a549af27ca
commit b4a362ef71
3 changed files with 29 additions and 1 deletions

View File

@ -64,6 +64,10 @@
#include "libbb.h" #include "libbb.h"
#include <setjmp.h> #include <setjmp.h>
#ifdef __GNO__
# include <gsos.h>
# include <orca.h>
#endif
/* This is a NOFORK applet. Be very careful! */ /* This is a NOFORK applet. Be very careful! */
@ -603,6 +607,29 @@ static int test_eaccess(char *path, int mode)
if (st.st_mode & mode) if (st.st_mode & mode)
return 0; return 0;
#ifdef __GNO__
/* Treat EXEC files as executable, which GNO's stat() doesn't */
if (mode & S_IXUSR) {
int result = -1;
FileInfoRecGS *fi;
GSStringPtr gs_path = __C2GSMALLOC(path);
if (gs_path == NULL)
return result;
fi = malloc(sizeof(FileInfoRecGS));
if (fi == NULL)
goto cleanup;
fi->pCount = 4;
fi->pathname = gs_path;
GetFileInfoGS(fi);
if (!toolerror() && fi->fileType == 0xB0 && fi->auxType == 0x0006)
result = 0;
cleanup:
free(fi);
GIfree(gs_path);
return result;
}
#endif
return -1; return -1;
} }

View File

@ -61,6 +61,7 @@
* avoid a couple definitions using ORCA/C's nonstandard inline directive. * avoid a couple definitions using ORCA/C's nonstandard inline directive.
*/ */
#ifdef __GNO__ #ifdef __GNO__
# define __USE_DYNAMIC_GSSTRING__
# define __KERN_STATUS # define __KERN_STATUS
# include <gno/gno.h> # include <gno/gno.h>
#endif #endif

View File

@ -70,7 +70,7 @@ int execve(const char *path, char *const *argv, char *const *envp)
{ {
char *args = NULL; char *args = NULL;
size_t pathlen; size_t pathlen;
GSString255 *path_gs = NULL; GSString255Ptr path_gs = NULL;
static FileInfoRecGS fileInfoRec; static FileInfoRecGS fileInfoRec;
int script_fd; int script_fd;
static char hashbang_line[MAX_HASHBANG_LINE + 1]; static char hashbang_line[MAX_HASHBANG_LINE + 1];