summaryrefslogtreecommitdiffstats
path: root/src/pulse/util.c
diff options
context:
space:
mode:
authorColin Guthrie <cguthrie@mandriva.org>2011-02-25 09:24:07 +0000
committerColin Guthrie <cguthrie@mandriva.org>2011-02-25 09:24:07 +0000
commita3dbdb044656e2f3ab9c7ae54fe74b9669155f2d (patch)
treed033464ab41e36f04763235160f1024afa0438b7 /src/pulse/util.c
parentf51889c6f64f11221caba3615bf779fc19d0dd15 (diff)
parent821562b9bc8d1a9033daaae0fd5373498a085054 (diff)
Merge remote-tracking branch 'mkbosmans/mingw32-build'
Diffstat (limited to 'src/pulse/util.c')
-rw-r--r--src/pulse/util.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/pulse/util.c b/src/pulse/util.c
index ca766dab..c5cfc8ca 100644
--- a/src/pulse/util.c
+++ b/src/pulse/util.c
@@ -37,10 +37,6 @@
#include <pwd.h>
#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
@@ -56,7 +52,7 @@
#include <pulse/xmalloc.h>
#include <pulse/timeval.h>
-#include <pulsecore/winsock.h>
+#include <pulsecore/socket.h>
#include <pulsecore/core-error.h>
#include <pulsecore/log.h>
#include <pulsecore/core-util.h>
@@ -79,11 +75,15 @@ char *pa_get_user_name(char *s, size_t l) {
pa_assert(s);
pa_assert(l > 0);
- if ((p = (getuid() == 0 ? "root" : NULL)) ||
- (p = getenv("USER")) ||
- (p = getenv("LOGNAME")) ||
- (p = getenv("USERNAME")))
- {
+ p = NULL;
+#ifdef HAVE_GETUID
+ p = getuid() == 0 ? "root" : NULL;
+#endif
+ if (!p) p = getenv("USER");
+ if (!p) p = getenv("LOGNAME");
+ if (!p) p = getenv("USERNAME");
+
+ if (p) {
name = pa_strlcpy(s, p, l);
} else {
#ifdef HAVE_PWD_H
@@ -195,11 +195,11 @@ char *pa_get_binary_name(char *s, size_t l) {
{
char *rp;
- if ((rp = pa_readlink("/proc/curproc/file"))) {
- pa_strlcpy(s, pa_path_get_filename(rp), l);
- pa_xfree(rp);
- return s;
- }
+ if ((rp = pa_readlink("/proc/curproc/file"))) {
+ pa_strlcpy(s, pa_path_get_filename(rp), l);
+ pa_xfree(rp);
+ return s;
+ }
}
#endif