~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/zfile.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
    tmp_name = archdep_tmpnam();
181
181
 
182
182
    fddest = fopen(tmp_name, MODE_WRITE);
183
 
    if (fddest == NULL)
 
183
    if (fddest == NULL) {
 
184
        lib_free(tmp_name);
184
185
        return NULL;
 
186
    }
185
187
 
186
188
    fdsrc = gzopen(name, MODE_READ);
187
189
    if (fdsrc == NULL) {
188
190
        fclose(fddest);
189
191
        ioutil_remove(tmp_name);
 
192
        lib_free(tmp_name);
190
193
        return NULL;
191
194
    }
192
195
 
770
773
        return -1;
771
774
 
772
775
    fddest = gzopen(src, MODE_WRITE"9");
773
 
    if (fddest == NULL)
774
 
    {
 
776
    if (fddest == NULL) {
775
777
        fclose(fdsrc);
776
778
        return -1;
777
779
    }
848
850
 
849
851
/* Compress `src' into `dest' using algorithm `type'.  */
850
852
static int zfile_compress(const char *src, const char *dest,
851
 
            enum compression_type type)
 
853
                          enum compression_type type)
852
854
{
853
855
    char *dest_backup_name;
854
856
    int retval;
913
915
    }
914
916
 
915
917
    switch (type) {
916
 
        case COMPR_GZIP:
917
 
            retval = compress_with_gzip(src, dest);
918
 
            break;
919
 
        case COMPR_BZIP:
920
 
            retval = compress_with_bzip(src, dest);
921
 
            break;
922
 
        default:
923
 
            retval = -1;
 
918
      case COMPR_GZIP:
 
919
        retval = compress_with_gzip(src, dest);
 
920
        break;
 
921
      case COMPR_BZIP:
 
922
        retval = compress_with_bzip(src, dest);
 
923
        break;
 
924
      default:
 
925
        retval = -1;
924
926
    }
925
927
 
926
928
    if (retval == -1) {
971
973
    if (!zinit_done)
972
974
        zinit();
973
975
 
 
976
    if (name == NULL || name[0] == 0)
 
977
        return NULL;
 
978
 
974
979
    /* Do we want to write to this file?  */
975
980
    if ((strchr(mode, 'w') != NULL) || (strchr(mode, '+') != NULL))
976
981
        write_mode = 1;
1011
1016
        return -1;
1012
1017
 
1013
1018
    switch(ptr->action) {
1014
 
        case ZFILE_KEEP:
1015
 
            break;
1016
 
        case ZFILE_REQUEST:
1017
 
        /*
1018
 
            ui_zfile_close_request(ptr->orig_name, ptr->request_string);
1019
 
            break;
1020
 
        */
1021
 
        case ZFILE_DEL:
1022
 
            if (ioutil_remove(ptr->orig_name) < 0)
1023
 
                log_error(zlog, "Cannot unlink `%s': %s",
1024
 
                    ptr->orig_name, strerror(errno));
1025
 
            break;
 
1019
      case ZFILE_KEEP:
 
1020
        break;
 
1021
      case ZFILE_REQUEST:
 
1022
      /*
 
1023
        ui_zfile_close_request(ptr->orig_name, ptr->request_string);
 
1024
        break;
 
1025
      */
 
1026
      case ZFILE_DEL:
 
1027
        if (ioutil_remove(ptr->orig_name) < 0)
 
1028
            log_error(zlog, "Cannot unlink `%s': %s",
 
1029
                ptr->orig_name, strerror(errno));
 
1030
        break;
1026
1031
    }
1027
1032
    return 0;
1028
1033
}