Dnia 2005-09-29 21:41, Colossus napisał:
Ok,

the correct way is to cast g_strerror to (char *):

response = ShowGtkMessageDialog (GTK_WINDOW (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,(char *) g_strerror(errno));

This way i don't get any warning.

But it's still incorrect. It should be

response = ShowGtkMessageDialog (GTK_WINDOW
        (MainWindow),GTK_DIALOG_MODAL,GTK_MESSAGE_ERROR,GTK_BUTTONS_OK,
        "%s", g_strerror(errno));

printf-like functions shouldn't take random strings as their format
string, as they may contain format instructions (such as %s, %d etc)
which will cause the function to look for non-existent arguments which
will produce segfault.


--
  Przemys³aw Sitek
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to