From: Andrew McNab Date: Fri, 24 Jul 2009 14:41:38 +0000 (+0000) Subject: Back ports from 1.7.x X-Git-Tag: gridsite-core_R_1_5_12~2 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=f2e644416b7bbf0c88f0fa86e9cbc3897b1607be;p=jra1mw.git Back ports from 1.7.x --- diff --git a/org.gridsite.core/CHANGES b/org.gridsite.core/CHANGES index 0bc1c72..37a71ee 100644 --- a/org.gridsite.core/CHANGES +++ b/org.gridsite.core/CHANGES @@ -1,3 +1,9 @@ +* Fri Jul 24 2009 Andrew McNab +- 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 - ==== GridSite version 1.5.12 ==== * Fri Jul 3 2009 Andrew McNab diff --git a/org.gridsite.core/interface/gridsite.h b/org.gridsite.core/interface/gridsite.h index bdd0ddc..347999e 100644 --- a/org.gridsite.core/interface/gridsite.h +++ b/org.gridsite.core/interface/gridsite.h @@ -67,12 +67,11 @@ // 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() */ diff --git a/org.gridsite.core/src/grst_admin_file.c b/org.gridsite.core/src/grst_admin_file.c index a9071c2..03eda2f 100644 --- a/org.gridsite.core/src/grst_admin_file.c +++ b/org.gridsite.core/src/grst_admin_file.c @@ -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" diff --git a/org.gridsite.core/src/grst_err.c b/org.gridsite.core/src/grst_err.c index 8d1e2cb..2d6ff5b 100644 --- a/org.gridsite.core/src/grst_err.c +++ b/org.gridsite.core/src/grst_err.c @@ -37,5 +37,5 @@ #include "gridsite.h" -void (*GRSTerrorLogFunc)(char *, int, int, char *, ...) = NULL; +int (*GRSTerrorLogFunc)(char *, int, int, char *, ...) = NULL; diff --git a/org.gridsite.core/src/htproxyput.c b/org.gridsite.core/src/htproxyput.c index df1ff8b..827d804 100644 --- a/org.gridsite.core/src/htproxyput.c +++ b/org.gridsite.core/src/htproxyput.c @@ -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[]) diff --git a/org.gridsite.core/src/mod_gridsite.c b/org.gridsite.core/src/mod_gridsite.c index badd565..169a312 100644 --- a/org.gridsite.core/src/mod_gridsite.c +++ b/org.gridsite.core/src/mod_gridsite.c @@ -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) diff --git a/org.gridsite.core/src/slashgrid.c b/org.gridsite.core/src/slashgrid.c index fe3bec5..076ff76 100644 --- a/org.gridsite.core/src/slashgrid.c +++ b/org.gridsite.core/src/slashgrid.c @@ -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[])