open(...O_CREAT...) fix
authorAndrew McNab <andrew.mcnab@manchester.ac.uk>
Fri, 24 Jul 2009 10:25:42 +0000 (10:25 +0000)
committerAndrew McNab <andrew.mcnab@manchester.ac.uk>
Fri, 24 Jul 2009 10:25:42 +0000 (10:25 +0000)
org.gridsite.core/CHANGES
org.gridsite.core/src/grst_admin_file.c

index ba55deb..0a85ae9 100644 (file)
@@ -3,6 +3,8 @@
   use most permissive time range they provide
 - Change (GRSTerrorLogFunc) to return int, to allow 
   if-less C macro using && instead.
+- Remove 2 argument open(...O_CREAT...) instance in
+  grst_admin_file.c
 * Fri Jul 03 2009 Andrew McNab <Andrew.McNab@cern.ch>
 - ==== GridSite version 1.7.4 ====
 * Thu Jul 02 2009 Andrew McNab <Andrew.McNab@cern.ch>
index 66fd13b..58f6ff2 100644 (file)
@@ -300,13 +300,14 @@ void deletefileaction(char *dn, GRSTgaclPerm perm, char *help_uri,
                       char *dir_path, char *file, char *dir_uri, 
                       char *admin_file)
 {
-  int            fd, numfiles;
+  int            numfiles;
   char          *dir_path_file, *dir_path_vfile, *p, *vfile, *dnlistsuri, 
                 *fulluri, *server_name, *realfile;
   struct stat    statbuf;
   GRSThttpBody   bp; 
   struct dirent *subdirfile_ent;
   DIR           *subDIR;
+  FILE          *fp;
 
 
   if( verifypasscode()==0 ){
@@ -375,8 +376,8 @@ void deletefileaction(char *dn, GRSTgaclPerm perm, char *help_uri,
           strcat(dir_path_file, "/");
           strcat(dir_path_file, vfile);
 
-          fd = open(dir_path_file, O_WRONLY | O_CREAT);
-          if (fd != -1) close(fd);           
+          fp = fopen(dir_path_file, "w");
+          if (fp != NULL) fclose(fp);
         }
 
       printf("Status: 302 Moved Temporarily\nContent-Length: 0\n"