www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/01/07/22:15:20

From: Dave Mason <dmason AT plg DOT uwaterloo DOT ca>
To: dj AT ctron DOT com
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: bug in exec(2) (with fix)
Date: Fri, 7 Jan 1994 21:58:45 -0500

Apart from one small buglet, execv etc. works well.  The bug is that
the initialization of rd in line 5 below was omitted, leading to
segfaults... (but it is *so* much nicer to be using a real compiler on
DOS -- where you *get* segfaults*, rather than random memory
corruption from (particularly Microsoft) commercial DOS compilers.

Now I just have to get file locking to work on Novell.

Thanks	../Dave
------------- libsrc/c/lib/exec.c --------------------
int spawnve(int mode, const char *path, const char **argv, const char **envp)
{
  /* This is the one that does the work! */
  int i = -1;
  char rpath[80], *rp, *rd=0;
  for (rp=rpath; *path; *rp++ = *path++)
  {
    if (*path == '.')
      rd = rp;
    if (*path == '\\' || *path == '/')
      rd = 0;
  }
  *rp = 0;
  if (rd)
  {
    for (i=0; interpreters[i].extension; i++)
      if (stricmp(rd, interpreters[i].extension) == 0)
        break;
  }

- Raw text -


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