From: "Havoc Pennington" <[EMAIL PROTECTED]>
> 
> "Ben K" <[EMAIL PROTECTED]> writes: 
> >     pppd_fd = open ("/etc/ppp/pppd.status", O_RDONLY); file://get the fd
> >     read(pppd_fd, label_text_ptr, 25);//read 25 bytes
> >     gtk_label_set_text(GTK_LABEL( (GtkWidget*)data ), label_text_ptr);
> 
> read() isn't going to nul-terminate your string. Use calloc() or
> g_malloc0() instead of malloc(). (Remember to use g_free() if you use
> g_malloc0()).
> 

You're also never close the file, so eventually the open will fail and
you'll be reading from an invalid fd.

Dom.



_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to