Back ports from 1.7.x
authorAndrew McNab <andrew.mcnab@manchester.ac.uk>
Fri, 24 Jul 2009 14:41:38 +0000 (14:41 +0000)
committerAndrew McNab <andrew.mcnab@manchester.ac.uk>
Fri, 24 Jul 2009 14:41:38 +0000 (14:41 +0000)
org.gridsite.core/CHANGES
org.gridsite.core/interface/gridsite.h
org.gridsite.core/src/grst_admin_file.c
org.gridsite.core/src/grst_err.c
org.gridsite.core/src/htproxyput.c
org.gridsite.core/src/mod_gridsite.c
org.gridsite.core/src/slashgrid.c

index 0bc1c72..37a71ee 100644 (file)
@@ -1,3 +1,9 @@
+* Fri Jul 24 2009 Andrew McNab <Andrew.McNab@cern.ch>
+- Back port fixes from 1.7.x, including:
+-  Remove 2 argument open(...O_CREAT...) instance in
+   grst_admin_file.c
+-  Change (GRSTerrorLogFunc) to return int, to allow 
+   if-less C macro using && instead.
 * Fri Jul  3 2009 Andrew McNab <Andrew.McNab@cern.ch>
 - ==== GridSite version 1.5.12 ====
 * Fri Jul  3 2009 Andrew McNab <Andrew.McNab@cern.ch>
index bdd0ddc..347999e 100644 (file)
 // No such file or directory
 #define GRST_RET_NO_SUCH_FILE  1003
 
+/* We use && now rather than if so this macro can be used inside if...else
+   but that means the function must return an int rather than be void */
+#define GRSTerrorLog(GRSTerrorLevel, ...) ((GRSTerrorLogFunc != NULL) && ((GRSTerrorLogFunc)(__FILE__, __LINE__, GRSTerrorLevel, __VA_ARGS__)))
 
-// #define GRSTerrorLog(GRSTerrorLevel, GRSTerrorFmt, ...) if (GRSTerrorLogFunc != NULL) (GRSTerrorLogFunc)(__FILE__, __LINE__, GRSTerrorLevel, GRSTerrorFmt, __VA_ARGS__)
-
-#define GRSTerrorLog(GRSTerrorLevel, ...) if (GRSTerrorLogFunc != NULL) (GRSTerrorLogFunc)(__FILE__, __LINE__, GRSTerrorLevel, __VA_ARGS__)
-
-extern void (*GRSTerrorLogFunc)(char *, int, int, char *, ...);
+extern int (*GRSTerrorLogFunc)(char *, int, int, char *, ...);
 
 /* these levels are the same as Unix syslog() and Apache ap_log_error() */
 
index a9071c2..03eda2f 100644 (file)
@@ -256,13 +256,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 ((file[0] == '\0') ||
       ((strcmp(file, GRST_ACL_FILE) != 0) && !GRSTgaclPermHasWrite(perm)) ||
@@ -325,8 +326,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"
index 8d1e2cb..2d6ff5b 100644 (file)
@@ -37,5 +37,5 @@
 
 #include "gridsite.h"
 
-void (*GRSTerrorLogFunc)(char *, int, int, char *, ...) = NULL;
+int (*GRSTerrorLogFunc)(char *, int, int, char *, ...) = NULL;
 
index df1ff8b..827d804 100644 (file)
@@ -87,7 +87,7 @@ void printsyntax(char *argv0)
           "(Version: %s)\n", p, VERSION);
 }
 
-void htproxy_logfunc(char *file, int line, int level, char *fmt, ...)
+int htproxy_logfunc(char *file, int line, int level, char *fmt, ...)
 {
   char *mesg;
   va_list ap;
@@ -99,6 +99,7 @@ void htproxy_logfunc(char *file, int line, int level, char *fmt, ...)
   fprintf(stderr, "%s(%d) %s\n", file, line, mesg);
 
   free(mesg);
+  return 0;
 }
   
 int main(int argc, char *argv[])
index badd565..169a312 100644 (file)
@@ -4284,7 +4284,7 @@ static int mod_gridsite_server_post_config(apr_pool_t *pPool,
 }
 
 static server_rec *mod_gridsite_log_func_server;
-static void mod_gridsite_log_func(char *file, int line, int level,
+static int mod_gridsite_log_func(char *file, int line, int level,
                                                     char *fmt, ...)
 {
    char *mesg;
@@ -4298,6 +4298,7 @@ static void mod_gridsite_log_func(char *file, int line, int level,
                 0, mod_gridsite_log_func_server, "%s", mesg);
    
    free(mesg);
+   return 0;
 }
       
 static void mod_gridsite_child_init(apr_pool_t *pPool, server_rec *pServer)
index fe3bec5..076ff76 100644 (file)
@@ -2604,7 +2604,7 @@ static struct fuse_operations slashgrid_oper = {
   .destroy     = slashgrid_destroy
 };
 
-void slashgrid_logfunc(char *file, int line, int level, char *fmt, ...)
+int slashgrid_logfunc(char *file, int line, int level, char *fmt, ...)
 {
   char *mesg;
   va_list ap;
@@ -2616,6 +2616,7 @@ void slashgrid_logfunc(char *file, int line, int level, char *fmt, ...)
   syslog(level, "%s(%d) %s", file, line, mesg);
   
   free(mesg);
+  return 0;
 }
 
 int main(int argc, char *argv[])