All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 4/4] Declare 'server_port' as an unsigned variable
Date: Sun, 28 Jul 2013 11:20:54 +0200	[thread overview]
Message-ID: <51F4E276.2090800@acm.org> (raw)
In-Reply-To: <51F4E1B2.7070203-HInyCGIudOg@public.gmane.org>

Change the data type of the 'server_port' variable from signed to
unsigned such that the cast in the fscanf() call can be removed.

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
---
 src/acm.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/acm.c b/src/acm.c
index 49bda48..33379cf 100644
--- a/src/acm.c
+++ b/src/acm.c
@@ -35,6 +35,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include <stdio.h>
+#include <inttypes.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
@@ -113,7 +114,7 @@ struct acm_msg {
 
 static pthread_mutex_t acm_lock = PTHREAD_MUTEX_INITIALIZER;
 static int sock = -1;
-static short server_port;
+static uint16_t server_port;
 
 struct ib_connect_hdr {
 	uint8_t  cma_version;
@@ -132,7 +133,7 @@ static int ucma_set_server_port(void)
 	FILE *f;
 
 	if ((f = fopen("/var/run/ibacm.port", "r" STREAM_CLOEXEC))) {
-		fscanf(f, "%hu", (unsigned short *) &server_port);
+		fscanf(f, "%" SCNu16, &server_port);
 		fclose(f);
 	}
 	return server_port;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2013-07-28  9:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-28  9:17 [PATCH 0/4] librdmacm compiler warning fixes Bart Van Assche
     [not found] ` <51F4E1B2.7070203-HInyCGIudOg@public.gmane.org>
2013-07-28  9:18   ` [PATCH 1/4] acm: Remove the unused variable 'pri_path' Bart Van Assche
2013-07-28  9:19   ` [PATCH 2/4] cma: Remove the unused variable 'id_priv' Bart Van Assche
2013-07-28  9:19   ` [PATCH 3/4] rsocket: Remove the unused variable 'ret' Bart Van Assche
2013-07-28  9:20   ` Bart Van Assche [this message]
     [not found]     ` <51F4E276.2090800-HInyCGIudOg@public.gmane.org>
2013-07-31  1:24       ` [PATCH 4/4] Declare 'server_port' as an unsigned variable Hefty, Sean

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F4E276.2090800@acm.org \
    --to=bvanassche-hinycgiudog@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.