fcoe-utils/0022-fcnsq-Fixup-64bit-integer-handling.patch
Hannes Reinecke 38a2ba7ad7 - Add systemd integration
- Reshuffle patches for upstream integration
- Remove old patches

OBS-URL: https://build.opensuse.org/package/show/network:fcoe/fcoe-utils?expand=0&rev=9
2013-12-06 11:55:35 +00:00

79 lines
1.8 KiB
Diff

From 0fc2690e701941dfa71ae207286b39b7d99ed801 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 6 Dec 2013 11:57:30 +0100
Subject: fcnsq: Fixup 64bit integer handling
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
fcnsq.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/fcnsq.c b/fcnsq.c
index 2510f1c..68a0697 100644
--- a/fcnsq.c
+++ b/fcnsq.c
@@ -24,6 +24,7 @@
#include <stdarg.h>
#include <stdbool.h>
#include <unistd.h>
+#include <inttypes.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
@@ -228,7 +229,7 @@ static int gpn_id(int bsg, u32 fcid)
rjt = gn_id(bsg, fcid, FC_NS_GPN_ID, &wwpn);
if (rjt)
goto fail;
- print_result("Port Name", "%16.16llx\n", wwpn);
+ print_result("Port Name", "%16.16jx\n", (uintmax_t)wwpn);
return 0;
fail:
if (rjt == (u16) ~0)
@@ -249,7 +250,7 @@ static int gnn_id(int bsg, u32 fcid)
rjt = gn_id(bsg, fcid, FC_NS_GNN_ID, &wwnn);
if (rjt)
goto fail;
- print_result("Node Name", "%16.16llx\n", wwnn);
+ print_result("Node Name", "%16.16jx\n", (uintmax_t)wwnn);
return 0;
fail:
if (rjt == (u16) ~0)
@@ -376,11 +377,12 @@ int main(int argc, char *argv[])
{
char *bsg;
int bsg_dev;
- u32 port_id;
- u64 wwnn;
+ u32 port_id = 0;
+ u64 wwnn = 0;
int rc = 0;
enum commands cmd = 0;
char c;
+ uintmax_t wwnn_tmp = 0;
while(1) {
c = getopt_long_only(argc, argv, "", options, NULL);
@@ -399,13 +401,17 @@ int main(int argc, char *argv[])
if (cmd)
help(-1);
cmd = c;
- sscanf(optarg, "%x", &port_id);
+ if (sscanf(optarg, "%x", &port_id) != 1)
+ help(-1);
break;
case GSNN_NN:
if (cmd)
help(-1);
cmd = c;
- sscanf(optarg, "%llx", &wwnn);
+ if (sscanf(optarg, "%jx", &wwnn_tmp) == 1)
+ wwnn = (u64)wwnn_tmp;
+ else
+ help(-1);
break;
}
}
--
1.8.1.4