www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/03/27/11:26:19

Date: Wed, 27 Mar 1996 18:17:55 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp AT delorie DOT com
Subject: Bug in `_is_executable', with a patch
Message-Id: <Pine.SUN.3.91.960327181348.4844T-100000@is>
Mime-Version: 1.0

There is a big in the current version of the library function 
`_is_executable'.  The bug manifests itself when `access' claims that 
files with `.com' and `.bat' extensions aren't executable.  To correct, 
apply the patch below to src/libc/posix/sys/stat/is_exec.c, compile it 
and update the library.

*** posix/sys/stat/is_exec.c~0	Sun Nov 12 23:22:48 1995
--- posix/sys/stat/is_exec.c	Tue Mar 26 23:04:52 1996
***************
*** 18,23 ****
--- 18,24 ----
  #include <libc/stubs.h>
  #include <stdio.h>
  #include <string.h>
+ #include <ctype.h>
  #include <errno.h>
  #include <dpmi.h>
  #include <go32.h>
*************** _is_executable(const char *filename, int
*** 182,192 ****
        && strlen(extension) <= ((extension[0]=='.') ? 4 : 3))
      {
        /* Search the list of extensions in executables[]. */
!       char tmp_buf[6];
  
!       tmp_buf[0] = '|';
!       strcpy(tmp_buf+1, *extension == '.' ? extension + 1 : extension);
!       strcat(tmp_buf, "|");
        if (strstr(non_executables, tmp_buf))
          return 0;
        else if (strstr(executables, tmp_buf))
--- 183,197 ----
        && strlen(extension) <= ((extension[0]=='.') ? 4 : 3))
      {
        /* Search the list of extensions in executables[]. */
!       char tmp_buf[5], *tp = tmp_buf;
  
!       *tp++ = '|';
!       if (*extension == '.')
! 	extension++;
!       while (*extension)
! 	*tp++ = toupper (*extension++);
!       *tp++ = '|';
!       *tp = '\0';
        if (strstr(non_executables, tmp_buf))
          return 0;
        else if (strstr(executables, tmp_buf))

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019