cvs commit: apache-2.0/src/lib/apr/file_io/win32 dir.c

2000-02-01 Thread stoddard
stoddard00/01/31 16:44:36

  Modified:src/lib/apr/file_io/win32 dir.c
  Log:
  CloseHandle() returns 0 on failure
  
  Revision  ChangesPath
  1.10  +3 -5  apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- dir.c 2000/01/11 23:23:49 1.9
  +++ dir.c 2000/02/01 00:44:34 1.10
  @@ -76,12 +76,10 @@
   ap_status_t dir_cleanup(void *thedir)
   {
   struct dir_t *dir = thedir;
  -if (CloseHandle(dir-dirhand) == 0) {
  -return APR_SUCCESS;
  +if (!CloseHandle(dir-dirhand)) {
  +return GetLastError();
   }
  -else {
  -return errno;
  -}
  +return APR_SUCCESS;
   } 
   
   ap_status_t ap_opendir(struct dir_t **new, const char *dirname, ap_context_t 
*cont)
  
  
  


cvs commit: apache-2.0/src/lib/apr/file_io/win32 dir.c

2000-02-01 Thread stoddard
stoddard00/01/31 16:51:46

  Modified:src/lib/apr/file_io/win32 dir.c
  Log:
  Return correct error status
  
  Revision  ChangesPath
  1.11  +14 -16apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- dir.c 2000/02/01 00:44:34 1.10
  +++ dir.c 2000/02/01 00:51:45 1.11
  @@ -103,11 +103,11 @@
   
   ap_status_t ap_closedir(struct dir_t *thedir)
   {
  -if (FindClose(thedir-dirhand)) {
  -ap_kill_cleanup(thedir-cntxt, thedir, dir_cleanup);
  -return APR_SUCCESS;
  +if (!FindClose(thedir-dirhand)) {
  +return GetLastError();   
   }
  -return APR_EEXIST;
  +ap_kill_cleanup(thedir-cntxt, thedir, dir_cleanup);
  +return APR_SUCCESS;
   }
   
   ap_status_t ap_readdir(struct dir_t *thedir)
  @@ -116,14 +116,14 @@
   thedir-entry = ap_palloc(thedir-cntxt, sizeof(WIN32_FIND_DATA));
   thedir-dirhand = FindFirstFile(thedir-dirname, thedir-entry);
   if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  -return APR_EEXIST;
  +return GetLastError();
   }
   return APR_SUCCESS;
   }
  -if (FindNextFile(thedir-dirhand, thedir-entry)) {
  -return APR_SUCCESS;
  +if (!FindNextFile(thedir-dirhand, thedir-entry)) {
  +return GetLastError();
   }
  -return APR_EEXIST;
  +return APR_SUCCESS;
   }
   
   ap_status_t ap_rewinddir(struct dir_t *thedir)
  @@ -146,21 +146,19 @@
   
   ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t 
*cont)
   {
  -if (CreateDirectory(path, NULL)) {
  -return APR_SUCCESS;
  +if (!CreateDirectory(path, NULL)) {
  +return GetLastError();
   }
  -return APR_EEXIST;
  +return APR_SUCCESS;
   }
   
   ap_status_t ap_remove_dir(const char *path, ap_context_t *cont)
   {
  -DWORD huh;
   char *temp = canonical_filename(cont, path);
  -if (RemoveDirectory(temp)) {
  -return APR_SUCCESS;
  +if (!RemoveDirectory(temp)) {
  +return GetLastError();
   }
  -huh = GetLastError();
  -return APR_EEXIST;
  +return APR_SUCCESS;
   }
   
   ap_status_t ap_dir_entry_size(ap_ssize_t *size, struct dir_t *thedir)
  
  
  


cvs commit: apache-2.0/src/lib/apr/file_io/win32 dir.c

2000-01-11 Thread stoddard
stoddard00/01/11 15:23:51

  Modified:src/lib/apr/file_io/win32 dir.c
  Log:
  What kinda coding style is this?
  
  Revision  ChangesPath
  1.9   +68 -68apache-2.0/src/lib/apr/file_io/win32/dir.c
  
  Index: dir.c
  ===
  RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- dir.c 1999/12/09 21:00:05 1.8
  +++ dir.c 2000/01/11 23:23:49 1.9
  @@ -86,122 +86,122 @@
   
   ap_status_t ap_opendir(struct dir_t **new, const char *dirname, ap_context_t 
*cont)
   {
  - char * temp;
  - (*new) = ap_palloc(cont, sizeof(struct dir_t));
  +char * temp;
  +(*new) = ap_palloc(cont, sizeof(struct dir_t));
   (*new)-cntxt = cont;
  - (*new)-entry = NULL;
  +(*new)-entry = NULL;
   temp = canonical_filename((*new)-cntxt, dirname);
   if (temp[strlen(temp)] == '/') {
(*new)-dirname = ap_pstrcat(cont, dirname, *, NULL);
  - }
  - else {
  +}
  +else {
   (*new)-dirname = ap_pstrcat(cont, dirname, /*, NULL);
  - }
  - (*new)-dirhand = INVALID_HANDLE_VALUE;
  - ap_register_cleanup((*new)-cntxt, (void *)(*new), dir_cleanup,
  - ap_null_cleanup);
  +}
  +(*new)-dirhand = INVALID_HANDLE_VALUE;
  +ap_register_cleanup((*new)-cntxt, (void *)(*new), dir_cleanup,
  +ap_null_cleanup);
   return APR_SUCCESS;
   }
   
   ap_status_t ap_closedir(struct dir_t *thedir)
   {
  - if (FindClose(thedir-dirhand)) {
  - ap_kill_cleanup(thedir-cntxt, thedir, dir_cleanup);
  - return APR_SUCCESS;
  - }
  - return APR_EEXIST;
  +if (FindClose(thedir-dirhand)) {
  +ap_kill_cleanup(thedir-cntxt, thedir, dir_cleanup);
  +return APR_SUCCESS;
  +}
  +return APR_EEXIST;
   }
   
   ap_status_t ap_readdir(struct dir_t *thedir)
   {
  - if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  - thedir-entry = ap_palloc(thedir-cntxt, 
sizeof(WIN32_FIND_DATA));
  - thedir-dirhand = FindFirstFile(thedir-dirname, thedir-entry);
  - if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  - return APR_EEXIST;
  - }
  - return APR_SUCCESS;
  - }
  - if (FindNextFile(thedir-dirhand, thedir-entry)) {
  - return APR_SUCCESS;
  - }
  - return APR_EEXIST;
  +if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  +thedir-entry = ap_palloc(thedir-cntxt, sizeof(WIN32_FIND_DATA));
  +thedir-dirhand = FindFirstFile(thedir-dirname, thedir-entry);
  +if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  +return APR_EEXIST;
  +}
  +return APR_SUCCESS;
  +}
  +if (FindNextFile(thedir-dirhand, thedir-entry)) {
  +return APR_SUCCESS;
  +}
  +return APR_EEXIST;
   }
   
   ap_status_t ap_rewinddir(struct dir_t *thedir)
   {
  - ap_status_t stat;
  - ap_context_t *cont = thedir-cntxt;
  +ap_status_t stat;
  +ap_context_t *cont = thedir-cntxt;
   char *temp = ap_pstrdup(cont, thedir-dirname);
  - temp[strlen(temp) - 2] = '\0';   /*remove the \* at the end */
  - if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  - return APR_SUCCESS;
  - }
  +temp[strlen(temp) - 2] = '\0';   /*remove the \* at the end */
  +if (thedir-dirhand == INVALID_HANDLE_VALUE) {
  +return APR_SUCCESS;
  +}
   if ((stat = ap_closedir(thedir)) == APR_SUCCESS) {
  - if ((stat = ap_opendir(thedir, temp, cont)) == APR_SUCCESS) {
  - ap_readdir(thedir);
  - return APR_SUCCESS;
  - }
  - }
  - return stat;
  +if ((stat = ap_opendir(thedir, temp, cont)) == APR_SUCCESS) {
  +ap_readdir(thedir);
  +return APR_SUCCESS;
  +}
  +}
  +return stat; 
   }
   
   ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t 
*cont)
   {
   if (CreateDirectory(path, NULL)) {
  - return APR_SUCCESS;
  - }
  +return APR_SUCCESS;
  +}
   return APR_EEXIST;
   }
   
   ap_status_t ap_remove_dir(const char *path, ap_context_t *cont)
   {
  -DWORD huh;
  +DWORD huh;
   char *temp = canonical_filename(cont, path);
  - if (RemoveDirectory(temp)) {
  - return APR_SUCCESS;
  - }
  - huh = GetLastError();
  - return APR_EEXIST;
  +if (RemoveDirectory(temp)) {
  +return APR_SUCCESS;
  +}
  +huh = GetLastError();
  +return APR_EEXIST;
   }
   
   ap_status_t ap_dir_entry_size(ap_ssize_t *size, struct dir_t *thedir)
   {
   if (thedir == NULL || thedir-entry == NULL) {
  - return APR_ENODIR;
  - }
  - (*size) = (thedir-entry-nFileSizeHigh * MAXDWORD) + 
  -