Package: coriander
Version: 1.0.1-3.1+b1
Severity: important

In overwrite mode, coriander always writes to the same file,
This causes the image to be broken while it is saving the file.

This patch makes coriander write to a file-tmp.ext an then rename
it to file.ext, making the file.ext to always be a complete image.


--- /tmp/coriander-1.0.1/src/thread_save.c      2004-11-24 03:39:18.000000000 
-0200
+++ src/thread_save.c   2007-05-09 23:28:31.000000000 -0300
@@ -135,6 +135,7 @@
 SaveThread(void* arg)
 {
   char *filename_out;
+  char *filename_out_tmp = NULL;
   chain_t* save_service=NULL;
   savethread_info_t *info=NULL;
   GdkImlibImage *im=NULL;
@@ -190,7 +191,9 @@
            // get filename
            switch (info->scratch) {
            case SAVE_SCRATCH_OVERWRITE:
-             sprintf(filename_out, "%s%s", info->filename,info->filename_ext);
+             sprintf(filename_out, "%s-tmp%s", 
info->filename,info->filename_ext);
+             filename_out_tmp=(char*)malloc(STRING_SIZE*sizeof(char));
+             sprintf(filename_out_tmp, "%s%s", 
info->filename,info->filename_ext);
              break;
            case SAVE_SCRATCH_SEQUENTIAL:
              switch (info->datenum) {
@@ -220,10 +223,15 @@
              if (info->rawdump>0) {
                if (info->scratch!=SAVE_SCRATCH_VIDEO) {
                  fd=fopen(filename_out,"w");
-                 if (fd==NULL)
+                 if (fd==NULL) {
                    MainError("Can't create/open image file for saving");
-                 else {
+                 } else {
                    fwrite(save_service->current_buffer->image, 1, 
save_service->current_buffer->buffer_image_bytes, fd);
+                   if(filename_out_tmp) {
+                       rename(filename_out, filename_out_tmp);
+                       free(filename_out_tmp);
+                       filename_out_tmp = NULL;
+                   }
                    fclose(fd);
                  }
                }
@@ -238,6 +246,12 @@
                    MainError("Can't save image with Imlib!");
                  }
                  gdk_imlib_kill_image(im);
+                 if(filename_out_tmp) {
+                    rename(filename_out, filename_out_tmp);
+                    free(filename_out_tmp);
+                    filename_out_tmp = NULL;
+                 }
+
                }
                else {
                  MainError("Can't create gdk image!");



-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.20.4-retirante3 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages coriander depends on:
ii  ftplib3                   3.1-1-6        Library of callable ftp routines
ii  gdk-imlib11               1.9.14-32      imaging library for use with gtk
ii  libart2                   1.4.2-35       The GNOME canvas widget - runtime 
ii  libaudiofile0             0.2.6-6        Open-source version of SGI's audio
ii  libc6                     2.5-7          GNU C Library: Shared libraries
ii  libdb3                    3.2.9+dfsg-0.1 Berkeley v3 Database Libraries [ru
ii  libdc1394-13              1.1.0-3+b1     high level programming interface f
ii  libesd0                   0.2.36-3       Enlightened Sound Daemon - Shared 
ii  libgdk-pixbuf2            0.22.0-11      The GdkPixBuf image library, gtk+ 
ii  libglib1.2                1.2.10-17      The GLib library of C routines
ii  libgnome32                1.4.2-35       The GNOME libraries
ii  libgnomesupport0          1.4.2-35       The GNOME libraries (Support libra
ii  libgnomeui32              1.4.2-35       The GNOME libraries (User Interfac
ii  libgtk1.2                 1.2.10-18      The GIMP Toolkit set of widgets fo
ii  libice6                   1:1.0.3-2      X11 Inter-Client Exchange library
ii  libraw1394-8              1.2.1-2        library for direct access to IEEE 
ii  libsdl1.2debian           1.2.11-8       Simple DirectMedia Layer
ii  libsm6                    1:1.0.2-2      X11 Session Management library
ii  libx11-6                  2:1.0.3-7      X11 client-side library
ii  libxext6                  1:1.0.3-2      X11 miscellaneous extension librar
ii  libxi6                    1:1.0.1-4      X11 Input extension library
ii  libxv1                    1:1.0.3-1      X11 Video extension library

coriander recommends no packages.

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to