[xiph-cvs] cvs commit: libshout/src shout.c
Brendan
brendan at xiph.org
Thu Apr 3 21:43:31 PST 2003
brendan 03/04/04 00:43:31
Modified: src shout.c
Log:
Always prepend slash to mount if missing.
Revision Changes Path
1.38 +12 -5 libshout/src/shout.c
Index: shout.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- shout.c 3 Apr 2003 00:29:03 -0000 1.37
+++ shout.c 4 Apr 2003 05:43:31 -0000 1.38
@@ -418,18 +418,26 @@
int shout_set_mount(shout_t *self, const char *mount)
{
- if (!self)
+ size_t len;
+
+ if (!self || !mount)
return SHOUTERR_INSANE;
if (self->connected)
return self->error = SHOUTERR_CONNECTED;
-
+
if (self->mount)
free(self->mount);
- if (!(self->mount = util_strdup(mount)))
+ len = strlen (mount) + 1;
+ if (mount[0] != '/')
+ len++;
+
+ if (!(self->mount = malloc(len)))
return self->error = SHOUTERR_MALLOC;
+ sprintf (self->mount, "%s%s", mount[0] == '/' ? "" : "/", mount);
+
return self->error = SHOUTERR_SUCCESS;
}
@@ -705,8 +713,7 @@
char *auth;
char *ai;
- if (!sock_write(self->socket, "SOURCE %s%s HTTP/1.0\r\n",
- self->mount[0] == '/' ? "" : "/", self->mount))
+ if (!sock_write(self->socket, "SOURCE %s HTTP/1.0\r\n", self->mount))
return SHOUTERR_SOCKET;
if (self->password && (auth = http_basic_authorization(self))) {
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list