delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/20/20:48:49

From: Martin Str|mberg <ams AT ludd DOT luth DOT se>
Message-Id: <199803210148.CAA15751@sister.ludd.luth.se>
Subject: Re: mkdir and errno
To: dj AT delorie DOT com
Date: Sat, 21 Mar 1998 02:48:25 +0100 (MET)
Cc: djgpp-workers AT delorie DOT com
Reply-To: martin DOT stromberg AT lu DOT erisoft DOT se (Martin Strömberg)
MIME-Version: 1.0

Indeed. New try follows. The reason I do like I do, is to make it easier
to add further errno improvments later (hint-hint, nudge).


Sigh,
							MartinS

*** libc/posix/sys/stat/mkdir.c.org     Sat Mar 21 02:02:35 1998
--- libc/posix/sys/stat/mkdir.c Sat Mar 21 02:33:54 1998
***************
*** 32,38 ****
--- 32,43 ----
        /* see if the directory existed, in which case
         we should return EEXIST - DJ */
        if (access(dirname, D_OK) == 0)
+       {
        errno = EEXIST;
+       return(-1);
+       }
+       /* Restore errno. */
+       errno = EACCES;
      }
      return -1;
    }

- Raw text -


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