From 205350e6adfb7548d68680cd1dea0760b1fd8bd7 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 11 Mar 2009 20:34:11 -0700 Subject: Fix warnings from redefining TRUE TRUE and FALSE are already defined in glib causing warnings. --- src/cli_val.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/cli_val.h b/src/cli_val.h index a753c92..e8fbe83 100644 --- a/src/cli_val.h +++ b/src/cli_val.h @@ -4,8 +4,12 @@ #define BITWISE 0 /* no partial commit */ #define boolean int -#define TRUE 1 +#ifndef FALSE #define FALSE 0 +#endif +#ifndef TRUE +#define TRUE (!FALSE) +#endif /* allocation unit for vals in valstruct */ #define MULTI_ALLOC 5 /* we have room if cnt%MULTI_ALLOC != 0 */ -- cgit v1.2.3 From e80e6a01a6396679e5293ec0b8b41c8c7378ea48 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 11 Mar 2009 20:44:30 -0700 Subject: Fix compiler warnings in commit2 Add headers with prototypes to remove compiler warnings Make some obvious tables const to avoid any bugs. --- src/commit2.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/commit2.c b/src/commit2.c index e6b63fa..bf5957d 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -2,16 +2,18 @@ #include #include #include +#include #include #include #include "common/common.h" +#include "cli_path_utils.h" boolean g_debug = FALSE; boolean g_display_error_node = FALSE; boolean g_coverage = FALSE; boolean g_dump_trans = FALSE; -int ActionOrder[top_act] = { +const int ActionOrder[top_act] = { 4, 5, 6, @@ -24,7 +26,7 @@ int ActionOrder[top_act] = { -char* ActionNames[top_act] = { +const char* ActionNames[top_act] = { "delete", //0 "create", //1 "activate", //2 @@ -81,7 +83,7 @@ also, the algorithm for collapsing the tree into a transaction list is: * **/ void -usage() +usage(void) { printf("commit2\n"); printf("\t-d\t\tdebug mode\n"); -- cgit v1.2.3 From b04d003bd7fe306819ddcad8398f62d6f71edb9d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 11 Mar 2009 20:47:02 -0700 Subject: Fix compiler warnings in unionfs Remove unused variables Remove extra arg from sprintf Fix missing prototype for piecewise_copy. --- src/common/unionfs.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/common/unionfs.c b/src/common/unionfs.c index 7c29ad1..5e90c0c 100644 --- a/src/common/unionfs.c +++ b/src/common/unionfs.c @@ -43,6 +43,9 @@ copy_func(GNode *node, gpointer data); static gboolean delete_func(GNode *node, gpointer data); +static void +piecewise_copy(GNode *root_node, boolean test_mode); + /** * * @@ -528,14 +531,6 @@ common_commit_copy_to_live_config(GNode *node, boolean test_mode) static const char format1[]="cp -r -f %s/* %s"; /*mdirp, tmpp*/ static const char format2[]="sudo umount %s"; //mdirp - - static const char format4[]="rm -rf %s/{.*,*} >&/dev/null ; /bin/true"; /*cdirp*/ - - //walk up tree until diverge or skip - static const char format6[]="cp -rf %s/* -t %s";/*tmpp, adirp*/ - - static const char format7[]="rm -fr %s >&/dev/null ; /bin/true"; /*tmpp*/ - static const char format8[]="sudo mount -t unionfs -o dirs=%s=rw:%s=ro unionfs %s"; //cdirp, adirp, mdirp set_echo(TRUE); @@ -991,7 +986,7 @@ struct SrcDst { /** * **/ -void +static void piecewise_copy(GNode *root_node, boolean test_mode) { struct SrcDst sd; @@ -1046,7 +1041,7 @@ copy_func(GNode *node, gpointer data) //this is for the case where it is set by default, then unset at the node--i.e. no longer a default value. if (((struct VyattaNode*)(node->data))->_config._multi == FALSE) { //only for leaf char *parent_path = ((struct VyattaNode*)(node->parent->data))->_data._path; - sprintf(command,clear_def,sd->_dst,parent_path,sd->_dst,parent_path); + sprintf(command,clear_def,sd->_dst,parent_path); if (g_debug) { printf("%s\n",command); fflush(NULL); -- cgit v1.2.3