~ubuntu-branches/ubuntu/maverick/xchat/maverick

« back to all changes in this revision

Viewing changes to debian/patches/45_save_ignore.patch

  • Committer: Bazaar Package Importer
  • Author(s): Lorenzo De Liso
  • Date: 2010-06-21 22:47:10 UTC
  • mfrom: (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20100621224710-9t1iyiglri330pss
Tags: 2.8.8-1ubuntu1
* Merge from debian unstable (LP: #597042), remaining changes:
  - debian/patches:
    + series: Refreshed.
    + 01_serverlist.patch: Numerous changes to default serverlist.
    + 02_ubuntu_default_server.patch: select "Ubuntu servers" by default.
    + 37_lpi.patch: Add launchpad integration.
    + 38_autoconf.patch: Autoconf modifications for launchpad integration.
    + 45_brand_ctcp_version.patch: Add Ubuntu brand to CTCP version response.
    + 70_notification_strings_shorten.patch: Shorten notification strings.
  - debian/control:
    + Build-depend on libgtk2.0-dev (>= 2.10.0).
    + Build-depend on liblaunchpad-integration-dev.
    + Remove conflict/replaces on xchat-gnome.
    + Updated Maintainer field to match Ubuntu Developers.
  - debian/rules:
    + Make build independent of the python version.
  - debian/patches/45_ctcp_version_less_information.dpatch: 
    + Renamed to debian/patches/45_brand_ctcp_version.patch
    + Added short description.
* Converted all patches to quilt, as in debian quilt has been
  adopted, all old dpatch patches have been renamed with the 
  *.patch extension.
* Dropped changes:
  - 71_notification_icon_change.patch: can't be applied

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## DP: write ignore.conf.bug463072 and rename to ignore.conf, fixes #463072.
 
2
--- a/src/common/cfgfiles.c
 
3
+++ b/src/common/cfgfiles.c
 
4
@@ -1093,6 +1093,20 @@
 
5
                return open (buf, flags | OFLAGS);
 
6
 }
 
7
 
 
8
+int
 
9
+xchat_rename_file (char *oldpath, char *newpath, int xof_flags)
 
10
+{
 
11
+       char bufoldpath[1024];
 
12
+       char bufnewpath[1024];
 
13
+
 
14
+       if (xof_flags & XOF_FULLPATH)
 
15
+               return rename (oldpath, newpath);
 
16
+
 
17
+       snprintf (bufoldpath, sizeof (bufoldpath), "%s/%s", get_xdir_fs (), oldpath);
 
18
+       snprintf (bufnewpath, sizeof (bufnewpath), "%s/%s", get_xdir_fs (), newpath);
 
19
+       return rename (bufoldpath, bufnewpath);
 
20
+}
 
21
+
 
22
 FILE *
 
23
 xchat_fopen_file (const char *file, const char *mode, int xof_flags)
 
24
 {
 
25
--- a/src/common/cfgfiles.h
 
26
+++ b/src/common/cfgfiles.h
 
27
@@ -25,6 +25,7 @@
 
28
 void list_addentry (GSList ** list, char *cmd, char *name);
 
29
 int cmd_set (session *sess, char *tbuf, char *word[], char *word_eol[]);
 
30
 int xchat_open_file (char *file, int flags, int mode, int xof_flags);
 
31
+int xchat_rename_file (char *oldpath, char *newpath, int xof_flags);
 
32
 FILE *xchat_fopen_file (const char *file, const char *mode, int xof_flags);
 
33
 #define XOF_DOMODE 1
 
34
 #define XOF_FULLPATH 2
 
35
--- a/src/common/ignore.c
 
36
+++ b/src/common/ignore.c
 
37
@@ -304,11 +304,12 @@
 
38
 ignore_save ()
 
39
 {
 
40
        char buf[1024];
 
41
-       int fh;
 
42
+       int fh, rc;
 
43
+       ssize_t nb;
 
44
        GSList *temp = ignore_list;
 
45
        struct ignore *ig;
 
46
 
 
47
-       fh = xchat_open_file ("ignore.conf", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
 
48
+       fh = xchat_open_file ("ignore.conf.bug463072", O_TRUNC | O_WRONLY | O_CREAT, 0600, XOF_DOMODE);
 
49
        if (fh != -1)
 
50
        {
 
51
                while (temp)
 
52
@@ -318,11 +319,28 @@
 
53
                        {
 
54
                                snprintf (buf, sizeof (buf), "mask = %s\ntype = %d\n\n",
 
55
                                                         ig->mask, ig->type);
 
56
-                               write (fh, buf, strlen (buf));
 
57
+                               nb = write (fh, buf, strlen (buf));
 
58
+                               if( nb == (ssize_t)-1 )
 
59
+                               {
 
60
+                                       perror( "ignore_save: write() failed" );
 
61
+                                       close( fh );
 
62
+                                       return;
 
63
+                               }
 
64
                        }
 
65
                        temp = temp->next;
 
66
                }
 
67
-               close (fh);
 
68
+               rc = close (fh);
 
69
+               if( rc != 0 )
 
70
+               {
 
71
+                       perror( "ignore_save: close() failed" );
 
72
+                       return;
 
73
+               }
 
74
+               rc = xchat_rename_file( "ignore.conf.bug463072", "ignore.conf", XOF_DOMODE );
 
75
+               if( rc != 0 )
 
76
+               {
 
77
+                       perror( "ignore_save: xchat_rename_file() failed" );
 
78
+                       return;
 
79
+               }
 
80
        }
 
81
 
 
82
 }