diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-11-26 00:07:24 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-11-26 00:07:24 +0000 |
commit | 9a9309f5938ecc2b79af72f1921ebd9178c029e4 (patch) | |
tree | 6266628dc6102b955447697139d1e595bfee49fc /polyp | |
parent | 758647868faf4c37845a3b572544313a34e5c579 (diff) |
* use setresuid() instead of setruid() if available
* if fix for the non-fp resampler
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@314 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp')
-rw-r--r-- | polyp/caps.c | 19 | ||||
-rw-r--r-- | polyp/resampler.c | 4 |
2 files changed, 15 insertions, 8 deletions
diff --git a/polyp/caps.c b/polyp/caps.c index 34d97eb5..93fca89f 100644 --- a/polyp/caps.c +++ b/polyp/caps.c @@ -23,6 +23,9 @@ #include <config.h> #endif +/* setresuid() is only available on GNU */ +#define _GNU_SOURCE + #include <assert.h> #include <unistd.h> #include <errno.h> @@ -41,13 +44,17 @@ void pa_drop_root(void) { if (uid == 0 || geteuid() != 0) return; - -/* pa_log(__FILE__": dropping root rights.\n"); */ - - setreuid(uid, uid); -/* setuid(uid); - seteuid(uid);*/ + /* pa_log(__FILE__": dropping root rights.\n"); */ + +#if defined(HAVE_SETRESUID) + setresuid(uid, uid, uid); +#elif defined(HAVE_SETREUID) + setreuid(uid, uid); +#else + setuid(uid); + seteuid(uid); +#endif } #ifdef HAVE_SYS_CAPABILITY_H diff --git a/polyp/resampler.c b/polyp/resampler.c index 377aa797..68c0129a 100644 --- a/polyp/resampler.c +++ b/polyp/resampler.c @@ -342,8 +342,8 @@ static void trivial_run(struct pa_resampler *r, const struct pa_memchunk *in, st unsigned j; j = (i->o_counter * r->i_ss.rate / r->o_ss.rate); - assert(j >= i->i_counter); - j = j - i->i_counter; + + j = j > i->i_counter ? j - i->i_counter : 0; if (j >= nframes) break; |