Skip to content

Commit e592a56

Browse files
committed
Do not hardcode port number
1 parent b36be02 commit e592a56

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

gpsd_client/src/client.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <sensor_msgs/NavSatFix.h>
2828
#include <sensor_msgs/NavSatStatus.h>
2929

30+
#include <cstdlib>
3031
#include <cmath>
3132

3233
using namespace gps_common;
@@ -45,12 +46,12 @@ class GPSDClient {
4546
privnode.param("frame_id", frame_id, frame_id);
4647

4748
std::string host = "localhost";
48-
int port = 2947;
49+
int port = atoi(DEFAULT_GPSD_PORT);
4950
privnode.getParam("host", host);
5051
privnode.getParam("port", port);
5152

5253
char port_s[12];
53-
snprintf(port_s, 12, "%d", port);
54+
snprintf(port_s, sizeof(port_s), "%d", port);
5455

5556
gps_data_t *resp = NULL;
5657

0 commit comments

Comments
 (0)