diff --git a/coreutils/test.c b/coreutils/test.c index 7a273c767..f6dc0f81b 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -64,6 +64,10 @@ #include "libbb.h" #include +#ifdef __GNO__ +# include +# include +#endif /* 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) 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; } diff --git a/include/libbb.h b/include/libbb.h index b71eddb14..1df921378 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -61,6 +61,7 @@ * avoid a couple definitions using ORCA/C's nonstandard inline directive. */ #ifdef __GNO__ +# define __USE_DYNAMIC_GSSTRING__ # define __KERN_STATUS # include #endif diff --git a/libbb/exec.gno.c b/libbb/exec.gno.c index 306e1e682..9e336ae9d 100644 --- a/libbb/exec.gno.c +++ b/libbb/exec.gno.c @@ -70,7 +70,7 @@ int execve(const char *path, char *const *argv, char *const *envp) { char *args = NULL; size_t pathlen; - GSString255 *path_gs = NULL; + GSString255Ptr path_gs = NULL; static FileInfoRecGS fileInfoRec; int script_fd; static char hashbang_line[MAX_HASHBANG_LINE + 1];