Re: Memory question
- From: Christian Neumair <chris gnome-de org>
- To: Przemysław Sitek <psitek rams pl>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Memory question
- Date: Thu, 29 Sep 2005 13:56:40 +0200
Am Donnerstag, den 29.09.2005, 13:39 +0200 schrieb PrzemysÅaw Sitek:
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 segfauls.
I wasn't aware that the called method has printf flavor. I wonder which
API provides ShowGtkMessageDialog.
--
Christian Neumair <chris gnome-de org>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]