[6171] in Moira
Patch to appease compilers using -Werror=format-security
daemon@ATHENA.MIT.EDU (Jonathan Reed)
Thu May 3 16:17:55 2012
Date: Thu, 3 May 2012 16:17:53 -0400 (EDT)
From: Jonathan Reed <jdreed@MIT.EDU>
To: moiradev@MIT.EDU
Message-ID: <alpine.DEB.2.02.1205031615580.16994@INFINITE-LOOP.MIT.EDU>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII
Hi Garry,
Ubuntu 12.04 has -Werror=format-security as a default when building
packages, and as a result Moira failed to build from source. We made the
following changes. Would you be willing to take them upstream?
Thanks,
Jon
Index: update/update_server.c
===================================================================
--- update/update_server.c (revision 4076)
+++ update/update_server.c (working copy)
@@ -227,7 +227,7 @@
void fail(int conn, int err, char *msg)
{
- com_err(whoami, err, msg);
+ com_err(whoami, err, "%s", msg);
close(conn);
exit(1);
}
Index: update/client.c
===================================================================
--- update/client.c (revision 4076)
+++ update/client.c (working copy)
@@ -169,6 +169,6 @@
void fail(int conn, int err, char *msg)
{
- com_err(whoami, err, msg);
+ com_err(whoami, err, "%s", msg);
return;
}
Index: clients/moira/attach.c
===================================================================
--- clients/moira/attach.c (revision 4076)
+++ clients/moira/attach.c (working copy)
@@ -188,7 +188,7 @@
static char *GetFSLabel(char **info)
{
- snprintf(labelbuf, sizeof(labelbuf), info[ALIAS_TRANS]);
+ snprintf(labelbuf, sizeof(labelbuf), "%s", info[ALIAS_TRANS]);
}
static int fsgCount = 1;
Index: clients/moira/main.c
===================================================================
--- clients/moira/main.c (revision 4076)
+++ clients/moira/main.c (working copy)
@@ -169,7 +169,7 @@
static void ErrorExit(char *buf, int status)
{
- com_err(program_name, status, buf);
+ com_err(program_name, status, "%s", buf);
mr_disconnect();
exit(1);
}
Index: clients/moira/namespace.c
===================================================================
--- clients/moira/namespace.c (revision 4076)
+++ clients/moira/namespace.c (working copy)
@@ -293,7 +293,7 @@
static void ErrorExit(char *buf, int status)
{
- com_err(program_name, status, buf);
+ com_err(program_name, status, "%s", buf);
mr_disconnect();
exit(1);
}
Index: clients/mailmaint/mailmaint.c
===================================================================
--- clients/mailmaint/mailmaint.c (revision 4076)
+++ clients/mailmaint/mailmaint.c (working copy)
@@ -216,7 +216,7 @@
exit(0);
punt:
- com_err(whoami, status, buf);
+ com_err(whoami, status, "%s", buf);
exit(1);
}
Index: clients/mrcheck/mrcheck.c
===================================================================
--- clients/mrcheck/mrcheck.c (revision 4076)
+++ clients/mrcheck/mrcheck.c (working copy)
@@ -224,7 +224,7 @@
exit(0);
punt:
- com_err(whoami, status, buf);
+ com_err(whoami, status, "%s", buf);
mr_disconnect();
exit(1);
}
Index: clients/mrtest/mrtest.c
===================================================================
--- clients/mrtest/mrtest.c (revision 4076)
+++ clients/mrtest/mrtest.c (working copy)
@@ -372,8 +372,7 @@
inp = fopen(argv[1], "r");
if (!inp)
{
- sprintf(input, "Cannot open input file %s", argv[1]);
- com_err("moira (script)", 0, input);
+ com_err("moira (script)", 0, "Cannot open input file %s", argv[1]);
return;
}
@@ -389,8 +388,7 @@
close(status);
dup2(oldstdout, 1);
argc = 2;
- sprintf(input, "Unable to redirect output to %s\n", argv[2]);
- com_err("moira (script)", errno, input);
+ com_err("moira (script)", errno, "Unable to redirect output to %s\n", argv[2]);
}
else
{
Index: lib/critical.c
===================================================================
--- lib/critical.c (revision 4076)
+++ lib/critical.c (working copy)
@@ -73,7 +73,7 @@
va_end(ap);
send_zgram(instance, buf);
- com_err(whoami, 0, buf);
+ com_err(whoami, 0, "%s", buf);
free(buf);
}