summaryrefslogtreecommitdiffstats
path: root/polyp/pid.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-12-11 00:10:41 +0000
committerLennart Poettering <lennart@poettering.net>2004-12-11 00:10:41 +0000
commit73eabece3365c1bb47bf6b009682219c4492fda5 (patch)
tree907b66e2fe29705a512e5f3a240210590b8fe9ba /polyp/pid.c
parent5be9641ffe18c482294c99345306c382ba4cf750 (diff)
* add first part of zeroconf publisher
* bump version to 0.7.1. * improve logging subsystem (introducing log levels) * remove verbose flag on cli * add new API pa_sample_format_to_string() * replace strtol() by usages of pa_atou() and pa_atoi() git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@317 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/pid.c')
-rw-r--r--polyp/pid.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/polyp/pid.c b/polyp/pid.c
index 32365136..2fac687e 100644
--- a/polyp/pid.c
+++ b/polyp/pid.c
@@ -43,8 +43,8 @@
* pid could be read, return 0, on failure (pid_t) -1 */
static pid_t read_pid(const char *fn, int fd) {
ssize_t r;
- char t[20], *e = NULL;
- long int pid;
+ char t[20], *e;
+ uint32_t pid;
assert(fn && fd >= 0);
@@ -57,8 +57,10 @@ static pid_t read_pid(const char *fn, int fd) {
return (pid_t) 0;
t[r] = 0;
+ if ((e = strchr(t, '\n')))
+ *e = 0;
- if (!t[0] || (pid = strtol(t, &e, 0)) == 0 || (*e != 0 && *e != '\n')) {
+ if (pa_atou(t, &pid) < 0) {
pa_log(__FILE__": WARNING: failed to parse PID file '%s'\n", fn);
return (pid_t) -1;
}