After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 437977 - Need to know the additional length used in the template by g_file_set_contents()
Need to know the additional length used in the template by g_file_set_contents()
Status: RESOLVED WONTFIX
Product: glib
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2007-05-12 20:29 UTC by Vincent Untz
Modified: 2010-08-26 03:58 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Vincent Untz 2007-05-12 20:29:42 UTC
g_file_set_contents() first creates a %s.XXXXXX filename. This adds 7 characters to the filename that will be written, and it can cause the write to file because it the filename passed by the user has a size of NAME_MAX (and thus the temp filename is longer than NAME_MAX).

So the length of ".XXXXXX" needs to be taken into account by the caller. We're not supposed to know that it's 7, so having a #define for this would be great.
Comment 1 Matthias Clasen 2007-05-17 16:53:18 UTC
I'd accept a patch to make g_file_set_contents() shorten the name as necessary
when creating the temporary name. But I don't think that the number 7 is a big secret, and I wouldn't hestitate using that knowledge if I were you.