[gedit] Implemented fallback strategy for saving files when opening files read/write is not supported
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: svn-commits-list gnome org
- Subject: [gedit] Implemented fallback strategy for saving files when opening files read/write is not supported
- Date: Sun, 10 May 2009 16:02:53 -0400 (EDT)
commit 1dcef327b6030e2a4feffab58762c824c126136f
Author: Jesse van den Kieboom <jesse icecrew nl>
Date: Sun May 10 22:02:16 2009 +0200
Implemented fallback strategy for saving files when opening files read/write is not supported
This should fix a problem with file systems that do not support opening files for read/write
(such as the fuse file system: curlftpfs). The strategy is to open the file write only when read/write
fails with ENOTSUP. This means that we will not be able to make a backup (and the user receives
a warning for this), but at least we can safe the file now.
---
gedit/gedit-local-document-saver.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gedit/gedit-local-document-saver.c b/gedit/gedit-local-document-saver.c
index c1818b7..82017a2 100644
--- a/gedit/gedit-local-document-saver.c
+++ b/gedit/gedit-local-document-saver.c
@@ -816,6 +816,15 @@ save_file (GeditLocalDocumentSaver *lsaver)
else if (errno == EEXIST)
{
lsaver->priv->fd = open (lsaver->priv->local_path, O_RDWR);
+
+ if (lsaver->priv->fd == -1 && errno == ENOTSUP)
+ {
+ /* Open for RDWR failed because it is not supported, open for write
+ * only. This will disable creating backups in the fallback
+ * strategy, but at least we can write the new file */
+ lsaver->priv->fd = open (lsaver->priv->local_path, O_WRONLY);
+ }
+
if (lsaver->priv->fd != -1)
{
next_phase = (GSourceFunc) save_existing_local_file;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]