Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: mkdir -p buldtin is possibly incorrect?



On Thu, Jul 14, 2005 at 11:47:03PM +0000, Bart Schaefer wrote:
> Won't stat() return an error on a dangling symlink and therefore make
> it appear that no file exists when in fact one does?

There seems to be no problem with this, since subsequent mkdir() call
is going to fail with EEXIST.

   127      if(p) {
   128          struct stat st;
   129
   130          if(!stat(rpath, &st) && S_ISDIR(st.st_mode))
   131              return 0;
   132      }
   133      oumask = umask(0);
   134      err = mkdir(path, mode) ? errno : 0;
   135      umask(oumask);
   136      if(!err)
   137          return 0;
   138      zwarnnam(nam, "cannot make directory `%s': %e", path, err);
   139      return 1;

Attachment: pgpwvFG9Fufbm.pgp
Description: PGP signature



Messages sorted by: Reverse Date, Date, Thread, Author