Re: Memory question
- From: PrzemysÅaw Sitek <psitek rams pl>
- To: gtk-app-devel-list gnome org
- Subject: Re: Memory question
- Date: Thu, 29 Sep 2005 13:39:50 +0200
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]