Changeset 12:675b8418ed59 in xplcommon for src
- Timestamp:
- 12/29/12 09:21:06 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/xplcommon/posix/LocalServerSocket.cc
r11 r12 32 32 #include "LocalServerSocket.h" 33 33 34 #include <cstdio> 34 35 #include <cerrno> 35 36 37 #include <pwd.h> 36 38 #include <unistd.h> 37 39 … … 42 44 43 45 using xplcommon::posix::LocalServerSocket; 46 47 //------------------------------------------------------------------------------ 48 49 void LocalServerSocket::setupPath(struct sockaddr_un& addr, const char* name) 50 { 51 #ifndef P_tmpdir 52 #define P_tmpdir "/tmp" 53 #endif 54 struct passwd* passwd = getpwuid(geteuid()); 55 const char* userName = (passwd==0) ? "unknown" : passwd->pw_name; 56 snprintf(addr.sun_path, sizeof(addr.sun_path), "%s/%s-%s", 57 P_tmpdir, name, userName); 58 } 44 59 45 60 //------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.