diff options
author | Frank Rowand <frank.rowand@sonymobile.com> | 2014-12-10 23:37:37 -0800 |
---|---|---|
committer | Jason Wessel <jason.wessel@windriver.com> | 2014-12-11 14:35:41 -0600 |
commit | 202fd1e15d9f08e8061835a138226480f68ae224 (patch) | |
tree | 560516202918601613cd0b691f30ef1e8aa13066 | |
parent | e8b26d8f6d5917d7ee4b02e10690288533534e1d (diff) | |
download | agent-proxy-202fd1e15d9f08e8061835a138226480f68ae224.tar.gz |
kgdb: kdmx agent-proxy: use max path length from header file
replace SERIAL_PORT_PATHLEN with MAXPATHLEN
Signed-off-by: Frank Rowand <frank.rowand@sonymobile.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
-rw-r--r-- | kdmx/kdmx.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/kdmx/kdmx.c b/kdmx/kdmx.c index 04f6879..ee47feb 100644 --- a/kdmx/kdmx.c +++ b/kdmx/kdmx.c @@ -29,6 +29,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/time.h> +#include <sys/param.h> /* * "Version Update Fix" @@ -72,7 +73,6 @@ enum { #define DEFAULT_SERIAL "/dev/ttyS0" #define BUFMAX 2048 -#define SERIAL_PORT_PATHLEN 512 int debug; int passthru_null_from_term; @@ -749,7 +749,7 @@ main(int argc, char **argv) { int select_nfds; struct termios termios; - char serial_port_path[SERIAL_PORT_PATHLEN + 1]; + char serial_port_path[MAXPATHLEN]; char *name; fd_set readfds; @@ -789,7 +789,7 @@ main(int argc, char **argv) break; case 'p': - if (strlen(optarg) > SERIAL_PORT_PATHLEN) { + if (strlen(optarg) >= sizeof(serial_port_path)) { pr_err("Path length for serial port too long\n"); exit(EXIT_FAILURE); } @@ -843,9 +843,9 @@ main(int argc, char **argv) serial_fd = open(serial_port_path, O_RDWR|O_NDELAY|O_NOCTTY); if (serial_fd == -1) { - char msg[SERIAL_PORT_PATHLEN + strlen("open of ") + 1]; + char msg[strlen("open() of ") + sizeof(serial_port_path) + 1]; memset(msg, 0, sizeof(msg)); - sprintf(msg, "open of %s", serial_port_path); + sprintf(msg, "open() of %s", serial_port_path); die(msg); } |