cpw.malu.xmpp.jingle_ft: d75bba8d: Init file descriptors to -1 (0 is a vali...

malu at pidgin.im malu at pidgin.im
Sun Apr 19 15:00:50 EDT 2009


-----------------------------------------------------------------
Revision: d75bba8d59e50c8a44f09ed5f474c6c6b5ae2ac3
Ancestor: 3b1bc046a34aae0543a73a4663bc36ee3359db96
Author: malu at pidgin.im
Date: 2009-04-19T18:59:28
Branch: im.pidgin.cpw.malu.xmpp.jingle_ft
URL: http://d.pidgin.im/viewmtn/revision/info/d75bba8d59e50c8a44f09ed5f474c6c6b5ae2ac3

Modified files:
        libpurple/protocols/jabber/jingle/s5b.c

ChangeLog: 

Init file descriptors to -1 (0 is a valid fd, normally stdin)

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/jingle/s5b.c	c545b311478872e05d47337b165abd4fb7889cc4
+++ libpurple/protocols/jabber/jingle/s5b.c	200dd7d6366d4bbd02382a161c47fe512e361f40
@@ -133,9 +133,9 @@ struct _JingleS5BPrivate {
 struct _JingleS5BPrivate {
 	/* S5B stuff here... */
 	gchar *sid;
-	guint fd;
-	guint local_fd;
-	guint remote_fd;
+	gint fd;
+	gint local_fd;
+	gint remote_fd;
 	PurpleProxyConnectData *connect_data;
 	PurpleNetworkListenData *listen_data;
 	PurpleProxyInfo *ppi;
@@ -226,7 +226,7 @@ jingle_s5b_class_init (JingleS5BClass *k
 		"The file descriptor for reading/writing data on the stream",
 		G_MININT,
 		G_MAXINT,
-		0,
+		-1,
 		G_PARAM_READABLE));
 	
 	g_type_class_add_private(klass, sizeof(JingleS5BPrivate));
@@ -237,6 +237,9 @@ jingle_s5b_init (JingleS5B *s5b)
 {	
 	s5b->priv = JINGLE_S5B_GET_PRIVATE(s5b);
 	memset(s5b->priv, 0, sizeof(s5b->priv));
+	s5b->priv->fd = -1;
+	s5b->priv->local_fd = -1;
+	s5b->priv->remote_fd = -1;
 }
 
 static void
@@ -425,9 +428,9 @@ jingle_s5b_surrender(JingleS5B *s5b)
 		"in jingle_s5b_surrender, using remote streamhost\n");
 	s5b->priv->fd = s5b->priv->remote_fd;
 	
-	if (s5b->priv->local_fd) {
+	if (s5b->priv->local_fd >= 0) {
 		close(s5b->priv->local_fd);
-		s5b->priv->local_fd = 0;
+		s5b->priv->local_fd = -1;
 	}
 	
 	if (s5b->priv->watcher) {
@@ -448,9 +451,9 @@ jingle_s5b_take_command(JingleS5B *s5b)
 		"in jingle_s5b_take_command, using local streamhost\n");
 	s5b->priv->fd = s5b->priv->local_fd;
 	
-	if (s5b->priv->remote_fd) {
+	if (s5b->priv->remote_fd >= 0) {
 		close(s5b->priv->remote_fd);
-		s5b->priv->remote_fd = 0;
+		s5b->priv->remote_fd = -1;
 	}
 	
 	if (s5b->priv->watcher) {


More information about the Commits mailing list