Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace buggy zed_file_create_dirs() #2248

Closed
wants to merge 2 commits into from
Closed

Replace buggy zed_file_create_dirs() #2248

wants to merge 2 commits into from

Commits on Apr 8, 2014

  1. Set errno for mkdirp() called with NULL path ptr

    If mkdirp() is called with a NULL ptr for the path arg, it will return
    -1 with errno unchanged.  This is unexpected since on error it should
    return -1 and set errno to one of the error values listed for mkdir(2).
    
    This commit sets errno = ENOENT for this NULL ptr case.  This is in
    accordance with the errors specified by mkdir(2):
    
      ENOENT
      A component of the path prefix does not exist or is a null pathname.
    
    Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
    dun committed Apr 8, 2014
    Copy the full SHA
    448a316 View commit details
    Browse the repository at this point in the history
  2. Replace zed_file_create_dirs() with mkdirp()

    When processing directory components starting from the root dir,
    zed_file_create_dirs() contained a bug in checking the return value of
    mkdir().  A typo was made, and the test for (mkdir_errno != EEXIST) was
    erroneously written as (mkdir_errno == EEXIST).  If some of the leading
    directory components already existed, this bug would cause the routine
    to exit before creating the remaining directory components.
    
    Instead of fixing the above mkdir_errno test, this commit replaces
    zed_file_create_dirs() with mkdirp().  This cleanup was already
    planned, and zed_file_create_dirs() only existed because I didn't
    realize mkdirp() was already in tree at the time.
    
    Signed-off-by: Chris Dunlap <cdunlap@llnl.gov>
    dun committed Apr 8, 2014
    1
    Copy the full SHA
    e55c05f View commit details
    Browse the repository at this point in the history