From 16de16f34de0496ad9004705946d43d6c636d201 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Thu, 3 Apr 2014 23:46:22 +0300 Subject: [PATCH] Extended the lentgh of user and host name. macro --- main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index f53cc9d..4c993e6 100644 --- a/main.c +++ b/main.c @@ -8,6 +8,7 @@ #define true 1 #define false 0 #define LEN 512 +#define HOST_USER_LEN 20 #define PATH "/bin/" #define ERROR -1 #define EXIT_1 256 @@ -68,7 +69,7 @@ int main() */ int getHostName(char* host) { - if(gethostname(host, 10) != 0) + if(gethostname(host, HOST_USER_LEN) != 0) { fprintf(stderr, "%s\n", "Error: while getting host name"); return ERROR; @@ -83,7 +84,7 @@ int main() */ int getUserName(char* name) { - if(getlogin_r(name, 10) != 0) + if(getlogin_r(name, HOST_USER_LEN) != 0) { fprintf(stderr, "%s\n", "Error: while getting User name"); return ERROR;