[polypaudio-commits] r825 - /trunk/src/polypcore/authkey.c
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Tue May 2 02:50:39 PDT 2006
Author: ossman
Date: Tue May 2 11:50:37 2006
New Revision: 825
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=825&root=polypaudio&view=rev
Log:
We need to read the cookie in binary mode for things to work correctly.
Modified:
trunk/src/polypcore/authkey.c
Modified: trunk/src/polypcore/authkey.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polypcore/authkey.c?rev=825&root=polypaudio&r1=824&r2=825&view=diff
==============================================================================
--- trunk/src/polypcore/authkey.c (original)
+++ trunk/src/polypcore/authkey.c Tue May 2 11:50:37 2006
@@ -59,6 +59,10 @@
return 0;
}
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
/* Load an euthorization cookie from file fn and store it in data. If
* the cookie file doesn't exist, create it */
static int load(const char *fn, void *data, size_t length) {
@@ -68,8 +72,8 @@
ssize_t r;
assert(fn && data && length);
- if ((fd = open(fn, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) {
- if (errno != EACCES || (fd = open(fn, O_RDONLY)) < 0) {
+ if ((fd = open(fn, O_RDWR|O_CREAT|O_BINARY, S_IRUSR|S_IWUSR)) < 0) {
+ if (errno != EACCES || (fd = open(fn, O_RDONLY|O_BINARY)) < 0) {
pa_log(__FILE__": failed to open cookie file '%s': %s", fn, strerror(errno));
goto finish;
} else
@@ -84,6 +88,7 @@
}
if ((size_t) r != length) {
+ pa_log_debug(__FILE__": got %d bytes from cookie file '%s', expected %d", (int)r, fn, (int)length);
if (!writable) {
pa_log(__FILE__": unable to write cookie to read only file");
More information about the pulseaudio-commits
mailing list