1. 16 Sep, 2006 1 commit
    • Paul Eggert's avatar
      * lib/dirchownmod.c: Don't include fcntl.h; no longer needed. · eeb96e1a
      Paul Eggert authored
      (dirchownmod): New arg FD.  All callers changed.
      Use FD rather than opening the directory ourself, as opening is
      now the caller's responsibility.
      * lib/dirchownmod.h: Likewise.
      * lib/mkancesdirs.c: Include <sys/types.h>, for portability to older
      hosts that require <sys/types.h> before <sys/stat.h>.  Include
      fcntl.h, savewd.h, and unistd.h, not dirname.h and stat-macros.h.
      (test_dir): Remove.
      (mkancesdirs): Return length of prefix of FILE that has already
      been made, or -2 if there is a child doing the work.  Redo
      algorithm so that it is O(N) rather than O(N**2).  Optimize away
      ".", and treat ".." specially since it might stray back into
      already-created areas.  Use a subprocess if necessary.  New arg
      WD; all users changed.  MAKE_DIR function should now return 1
      if it creates a directory that is not readable.  Return -2 if
      a child process is spun off.
      * lib/mkancesdirs.h: Include <stddef.h>, for ptrdiff_t.
      Adjust signature to match code.
      * lib/mkdir-p.c: Include dirname.h, for IS_ABSOLUTE_FILE_NAME.
      (make_dir_parents): Use a subprocess if necessary.  New arg WD;
      all users changed.
      * lib/savewd.c, lib/savewd.h: New files.
      * m4/savewd.m4: New file.
      * modules/mkancesdirs (Depends-on): Add fcntl.
      * modules/savewd: New file.
      * MODULES.html.sh (File system functions): Add savewd.
      eeb96e1a
  2. 17 Jul, 2006 1 commit
    • Paul Eggert's avatar
      Import from coreutils. · 5f531596
      Paul Eggert authored
      * MODULES.html.sh: Add mkancestors.
      * modules/mkancesdirs: New module.
      * modules/mkdir-p (Files): Remove lib/chdir-safer.c, lib/chdir-safer.h,
      lib/same-inode.h, m4/afs.m4, m4/chdir-safer.m4.
      The chdir-safer and afs files are now orphans; I'll remove them
      unless someone speaks up.
      Add lib/dirchownmod.c, lib/dirchownmod.h.
      (Depends-on): Remove alloca, chown, save-cwd, dirname.
      Add lchown, mkancesdirs.
      (Maintainer): Add self.
      
      * lib/dirchownmod.c, lib/dirchownmod.h:
      * lib/mkancesdirs.c, lib/mkancesdirs.h: New files.
      * lib/mkdir-p.c: Don't include alloca.h, stdio.h, sys/types.h,
      unistd.h, string.h, chdir-safer.h, dirname.h, lchmod.h, lchown.h,
      save-cwd.h.  Instead, include dirchownmod.h and mkancesdirs.h.
      (make_dir_parents): New args MAKE_ANCESTOR, OPTIONS, ANNOUNCE,
      MODE_BITS.  Remove options VERBOSE_FMT_STRING, CWD_ERRNO.  All
      callers changed.  Revamp internals significantly, by not
      attempting to create directories that are temporarily more
      permissive than the final results.  Do not attempt to use
      save_cwd/restore_cwd; it isn't worth it for mkdir and install.
      This removes some race conditions, fixes some bugs, and simplifies
      things.  Use new dirchownmod function to do owner and mode changes.
      * lib/mkdir-p.h: Likewise.
      * lib/modechange.c (octal_to_mode): New function.
      (struct mode_change): New member mentioned.
      (make_node_op_equals): New arg mentioned.  All callers changed.
      (mode_compile): Keep track of which mode bits the user has explicitly
      mentioned.
      (mode_adjust): New arg DIR, so that we implement the X op correctly.
      New arg PMODE_BITS, to keep track of which mode bits the user
      mentioned; it treats S_ISUID and S_ISGID speciall.
      All callers changed.
      * lib/modechange.h: Likewise.
      
      * mkancesdirs.m4: New file.
      * mkdir-p.m4 (gl_MKDIR_PARENTS): Mention dirchownmod.c, dirchownmod.h.
      Don't require AC_FUNC_ALLOCA, gl_AFS, gl_CHDIR_SAFER; no longer needed.
      Require gl_FUNC_LCHOWN, since dirchownmod.c needs it.
      5f531596