You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2014/01/03 18:19:07 UTC
[36/50] git commit: TS-2457 Fix usage around strtol,
bad review on my part
TS-2457 Fix usage around strtol, bad review on my part
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/74af2183
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/74af2183
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/74af2183
Branch: refs/heads/5.0.x
Commit: 74af2183c3641a3c0f2b7f024b17d5d0db814e93
Parents: 1ef6009
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Dec 31 19:54:29 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Dec 31 19:54:29 2013 -0700
----------------------------------------------------------------------
example/protocol/Protocol.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/74af2183/example/protocol/Protocol.c
----------------------------------------------------------------------
diff --git a/example/protocol/Protocol.c b/example/protocol/Protocol.c
index 1258294..d065c9d 100644
--- a/example/protocol/Protocol.c
+++ b/example/protocol/Protocol.c
@@ -105,6 +105,7 @@ TSPluginInit(int argc, const char *argv[])
{
TSPluginRegistrationInfo info;
char *end;
+ int tmp;
info.plugin_name = "output-header";
info.vendor_name = "MyCompany";
@@ -125,9 +126,9 @@ TSPluginInit(int argc, const char *argv[])
printf("[protocol_plugin] Usage: protocol.so accept_port server_port\n");
printf("[protocol_plugin] Wrong arguments. Using deafult ports.\n");
} else {
- strtol(argv[1], &end, 10);
+ tmp = strtol(argv[1], &end, 10);
if (*end == '\0') {
- accept_port = strtol(argv[1], &end, 10);
+ accept_port = tmp;
TSDebug("protocol", "using accept_port %d", accept_port);
printf("[protocol_plugin] using accept_port %d\n", accept_port);
} else {
@@ -135,9 +136,9 @@ TSPluginInit(int argc, const char *argv[])
printf("Using deafult port %d\n", accept_port);
}
- strtol(argv[2], &end, 10);
+ tmp = strtol(argv[2], &end, 10);
if (*end == '\0') {
- server_port = strtol(argv[2], &end, 10);
+ server_port = tmp;
TSDebug("protocol", "using server_port %d", server_port);
printf("[protocol_plugin] using server_port %d\n", server_port);
} else {