From 472b6e23d1b8ab1614538466626c5ae6de46fb06 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 20 Jan 2011 02:11:57 -0500 Subject: [PATCH] vol: nt_open should not create missing directories Revert the prior change that added directory creation to nt_open(). nt_open() should fail and the caller should create the directories. Failure to do so results in an incomplete tree which confuses the salvager. Reviewed-on: http://gerrit.openafs.org/3709 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 1ad22ed7e14d1ed643add0dbf80c82b96ae69fc8) Change-Id: I4669ee27bd5c3d9100f3e7fc880d6c32e990493f Reviewed-on: http://gerrit.openafs.org/3844 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vol/ntops.c | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/src/vol/ntops.c b/src/vol/ntops.c index 79f7c5bac..4155e1367 100644 --- a/src/vol/ntops.c +++ b/src/vol/ntops.c @@ -119,39 +119,6 @@ nt_open(char *name, int flags, int mode) fh = CreateFile(name, nt_access, nt_share, NULL, nt_create, FandA, NULL); if (fh == INVALID_HANDLE_VALUE) { DWORD gle = GetLastError(); - - if (gle == ERROR_PATH_NOT_FOUND) { - /* - * one or more of the directories in the path - * does not exist. We must create them and - * try again to create the file. - */ - char * p; - - for (p=name; *p && *p != OS_DIRSEPC; p++); - while (*p == OS_DIRSEPC) p++; /* ignore the first dirsep */ - for (; *p; p++) { - if (*p == OS_DIRSEPC) { - *p = '\0'; - if (CreateDirectory(name, NULL)) - gle = 0; - else - gle = GetLastError(); - *p = OS_DIRSEPC; - if (gle != ERROR_SUCCESS && - gle != ERROR_ALREADY_EXISTS) { - /* The directory creation failed. */ - fh = INVALID_FD; - break; - } else { - while (*(p+1) == OS_DIRSEPC) p++; - } - } - } - - if (!*p) /* successful creation of the path */ - goto retry; - } errno = nterr_nt2unix(gle, EBADF); } return fh; -- 2.39.5