diff options
author | Ted Gould <ted@gould.cx> | 2012-08-21 14:30:41 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-08-21 14:30:41 -0500 |
commit | 402133a40e196f9acb64b989e3e42039f073ba52 (patch) | |
tree | 226e194c84b3ada0b9ff44272daf1381ee6dcf78 | |
parent | e610f6f207135dd5513a2c3120bf0ae391db2910 (diff) | |
download | lightdm-remote-session-arctica-402133a40e196f9acb64b989e3e42039f073ba52.tar.gz lightdm-remote-session-arctica-402133a40e196f9acb64b989e3e42039f073ba52.tar.bz2 lightdm-remote-session-arctica-402133a40e196f9acb64b989e3e42039f073ba52.zip |
Getting the directory using the home environment variable
-rw-r--r-- | socket-sucker.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/socket-sucker.c b/socket-sucker.c index 0b1ee27..b5fb543 100644 --- a/socket-sucker.c +++ b/socket-sucker.c @@ -17,11 +17,16 @@ main (int argc, char * argv[]) bzero((char *)&serv_addr, sizeof(serv_addr)); + const char * home = getenv("HOME"); + if (home == NULL) { + return -1; + } + serv_addr.sun_family = AF_UNIX; - strcpy(serv_addr.sun_path, "/home/ted/.freerdp-socket"); + snprintf(serv_addr.sun_path, sizeof(serv_addr.sun_path), "%s/%s", home, ".freerdp-socket"); servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family); - if ((socket_fd = socket(AF_UNIX, SOCK_STREAM,0)) < 0) { + if ((socket_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { return -1; } |