]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fixed compiler warnings reported on Ubuntu 10.04
authorDavid Sommerseth <dazo@users.sourceforge.net>
Fri, 17 Sep 2010 15:10:25 +0000 (17:10 +0200)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Thu, 21 Oct 2010 09:40:36 +0000 (11:40 +0200)
The warnings reported where:
--------------------------------------------------------
misc.c:158: warning: ignoring return value of ‘nice’, declared with attribute warn_unused_result
options.c:4033: warning: format not a string literal and no format arguments
options.c:4043: warning: format not a string literal and no format arguments
options.c:4053: warning: format not a string literal and no format arguments
push.c:182: warning: format not a string literal and no format arguments
push.c:199: warning: format not a string literal and no format arguments
push.c:235: warning: format not a string literal and no format arguments
status.c:171: warning: ignoring return value of ‘ftruncate’, declared with attribute warn_unused_result
--------------------------------------------------------

Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Acked-by: Peter Stuge <peter@stuge.se>
misc.c
options.c
push.c
status.c

diff --git a/misc.c b/misc.c
index 1f7f616c67fcc1a3719fcf970fd518810e04043f..f5ce590931ef798bca67d95b390a029fb31dd11d 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -155,9 +155,8 @@ set_nice (int niceval)
     {
 #ifdef HAVE_NICE
       errno = 0;
-      nice (niceval);
-      if (errno != 0)
-       msg (M_WARN | M_ERRNO, "WARNING: nice %d failed", niceval);
+      if (nice (niceval) < 0 && errno != 0)
+       msg (M_WARN | M_ERRNO, "WARNING: nice %d failed: %s", niceval, strerror(errno));
       else
        msg (M_INFO, "nice %d succeeded", niceval);
 #else
index 3c20f5bf650d7fd1cb0ce7a8d5627cb7d0f4be4a..a717e1e266547c06a33c804cf8ef2ac4458fcee5 100644 (file)
--- a/options.c
+++ b/options.c
@@ -4014,7 +4014,7 @@ add_option (struct options *options,
                    {
                      if (options->inetd != -1)
                        {
-                         msg (msglevel, opterr);
+                         msg (msglevel, "%s", opterr);
                          goto err;
                        }
                      else
@@ -4024,7 +4024,7 @@ add_option (struct options *options,
                    {
                      if (options->inetd != -1)
                        {
-                         msg (msglevel, opterr);
+                         msg (msglevel, "%s", opterr);
                          goto err;
                        }
                      else
@@ -4034,7 +4034,7 @@ add_option (struct options *options,
                    {
                      if (name != NULL)
                        {
-                         msg (msglevel, opterr);
+                         msg (msglevel, "%s", opterr);
                          goto err;
                        }
                      name = p[z];
diff --git a/push.c b/push.c
index 1320bec5221399656fc34b1fe32583ca99d04720..40e64c33e0f12d7659aa51b357129ed71c4e2ee0 100644 (file)
--- a/push.c
+++ b/push.c
@@ -179,7 +179,7 @@ send_push_reply (struct context *c)
   const int safe_cap = BCAP (&buf) - extra;
   bool push_sent = false;
 
-  buf_printf (&buf, cmd);
+  buf_printf (&buf, "%s", cmd);
 
   while (e)
     {
@@ -196,7 +196,7 @@ send_push_reply (struct context *c)
                push_sent = true;
                multi_push = true;
                buf_reset_len (&buf);
-               buf_printf (&buf, cmd);
+               buf_printf (&buf, "%s", cmd);
              }
            }
          if (BLEN (&buf) + l >= safe_cap)
@@ -232,7 +232,7 @@ send_push_reply (struct context *c)
       bool status = false;
 
       buf_reset_len (&buf);
-      buf_printf (&buf, cmd);
+      buf_printf (&buf, "%s", cmd);
       status = send_control_channel_string (c, BSTR(&buf), D_PUSH);
       if (!status)
        goto fail;
index 92fc7bcb8cac7ea36978a961aa24b49f6b87ebe0..4bbea28e4fddaf0cf6ec09754f710ac473fa787f 100644 (file)
--- a/status.c
+++ b/status.c
@@ -168,7 +168,9 @@ status_flush (struct status_output *so)
 #if defined(HAVE_FTRUNCATE)
       {
        const off_t off = lseek (so->fd, (off_t)0, SEEK_CUR);
-       ftruncate (so->fd, off);
+       if (ftruncate (so->fd, off) != 0) {
+         msg (M_WARN, "Failed to truncate status file: %s", strerror(errno));
+       }
       }
 #elif defined(HAVE_CHSIZE)
       {