codebrainz commented on this pull request.
> @@ -1955,37 +1961,51 @@ static gchar *write_data_to_disk(const gchar
> *locale_filename,
/* Use POSIX API for unsafe saving (GVFS-unsafe) */
/* The error handling is taken from glib-2.26.0 gfileutils.c */
errno = 0;
- fp = g_fopen(locale_filename, "wb");
+ fp = g_fopen(locale_filename, "w+b"); // we can not destroy
symbolic/hard links
The [linked document](http://www.cplusplus.com/reference/cstdio/fopen/) says
for "w+":
> write/update: Create an empty file and open it for update (both for input and
> output). If a file with the same name already exists its contents are
> discarded and the file is treated as a new empty file.
And my [man pages say](http://man7.org/linux/man-pages/man3/fopen.3.html):
> Open for reading and writing. The file is created if it does not exist,
> otherwise it is truncated. The stream is positioned at the beginning of the
> file.
Both sources seem to agree that the file is truncated for both "w" and "w+". Am
I being dense?
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/1270