source: patches/file-5.00-fixes-2.patch @ fa1650f7

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since fa1650f7 was 1204c773, checked in by Jim Gifford <clfs@…>, 15 years ago

Updated File Fixes Patch to -2

  • Property mode set to 100644
File size: 5.2 KB
  • magic/Magdir/msdos

    Submitted by: Jim Gifford (jim at cross-lfs dot org)
    Date: 2009-03-01
    Initial Package Version: 5.00
    Upstream Status: Already Applied
    Origin: Jim Gifford
    Description: Fixes Various Build Issues in File
                 Localization Fixes
    
    diff -Naur file-5.00.orig/magic/Magdir/msdos file-5.00/magic/Magdir/msdos
    old new  
    294294>10     string  >\x23                   
    295295>>10    string  !\x2e                   
    296296>>>17   string  <\x5B                   
    297 >>>>10  string  x                       \b, name: %.8s
    298 #UDMA.SYS KEYB.SYS CMD640X2.SYS
     297>>>>10  string  CMD640X2.SYS                    \b, name: %.8s
     298#UDMA.SYS
    299299>10     string  <\x41                   
    300300>>12    string  >\x40                   
    301301>>>10   string  !$                     
    302 >>>>12  string  x                       \b, name: %.8s
    303 #BTCDROM.SYS ASPICD.SYS
     302>>>>12  string  UDMA.SYS                        \b, name: %.8s
     303#CMD640X2.SYS
     304>10     string  <\x41                   
     305>>12    string  >\x40                   
     306>>>10   string  !$                     
     307>>>>12  string  CMD640X2.SYS                    \b, name: %.8s
     308#KEYB.SYS
     309>10     string  <\x41                   
     310>>12    string  >\x40                   
     311>>>10   string  !$                     
     312>>>>12  string  KEYB.SYS                        \b, name: %.8s
     313#BTCDROM.SYS
     314>22     string  >\x40                   
     315>>22    string  <\x5B                   
     316>>>23   string  <\x5B                   
     317>>>>22  string  BTCDROM.SYS                     \b, name: %.8s
     318#ASPICD.SYS
    304319>22     string  >\x40                   
    305320>>22    string  <\x5B                   
    306321>>>23   string  <\x5B                   
    307 >>>>22  string  x                       \b, name: %.8s
     322>>>>22  string  ASPICD.SYS                      \b, name: %.8s
    308323#ATAPICD.SYS
    309324>76     string  \0                     
    310325>>77    string  >\x40                   
    311326>>>77   string  <\x5B                   
    312 >>>>77  string  x                       \b, name: %.8s
     327>>>>77  string  ATAPICD.SYS                     \b, name: %.8s
    313328# test too generic ?
    3143290       byte            0x8c            DOS executable (COM)
    315330# updated by Joerg Jenderek at Oct 2008
  • src/cdf.c

    diff -Naur file-5.00.orig/src/cdf.c file-5.00/src/cdf.c
    old new  
    239239        cdf_unpack_header(h, buf);
    240240        cdf_swap_header(h);
    241241        if (h->h_magic != CDF_MAGIC) {
    242                 DPRINTF(("Bad magic 0x%x != 0x$x\n", h->h_magic, CDF_MAGIC));
     242                DPRINTF(("Bad magic 0x%llx != 0x%llx\n",
     243                    (unsigned long long)h->h_magic,
     244                    (unsigned long long)CDF_MAGIC));
    243245                errno = EFTYPE;
    244246                return -1;
    245247        }
     
    539541                if (dir->dir_tab[i].d_type == CDF_DIR_TYPE_ROOT_STORAGE)
    540542                        break;
    541543
     544        /* If the it is not there, just fake it; some docs don't have it */
    542545        if (i == dir->dir_len) {
    543                 DPRINTF(("Cannot find root storage node\n"));
    544                 errno = EFTYPE;
    545                 return -1;
     546                scn->sst_tab = NULL;
     547                scn->sst_len = 0;
     548                return 0;
    546549        }
    547550        d = &dir->dir_tab[i];
    548551
  • src/readcdf.c

    diff -Naur file-5.00.orig/src/readcdf.c file-5.00/src/readcdf.c
    old new  
    7575                        if (len > 1) {
    7676                                s = info[i].pi_str.s_buf;
    7777                                if (NOTMIME(ms)) {
    78                                         if (file_printf(ms, ", %s: %.*s", buf,
    79                                             len, s) == -1)
    80                                                 return -1;
     78                                        char vbuf[1024];
     79                                        size_t j;
     80                                        for (j = 0; j < sizeof(vbuf) && len--;
     81                                            j++, s++) {
     82                                                if (*s == '\0')
     83                                                        break;
     84                                                if (isprint((unsigned char)*s))
     85                                                        vbuf[j] = *s;
     86                                        }
     87                                        if (j == sizeof(vbuf))
     88                                                --j;
     89                                        vbuf[j] = '\0';
     90                                        if (vbuf[0]) {
     91                                                if (file_printf(ms, ", %s: %s",
     92                                                    buf, vbuf) == -1)
     93                                                        return -1;
     94                                        }
    8195                                } else if (info[i].pi_id ==
    8296                                        CDF_PROPERTY_NAME_OF_APPLICATION) {
    8397                                        if (strstr(s, "Word"))
     
    115129                case CDF_CLIPBOARD:
    116130                        break;
    117131                default:
    118                         file_error(ms, 0, "Internal parsing error");
     132#ifndef EFTYPE  /* XXX: vapier: copied from cdf.c for now ... */
     133#define EFTYPE EINVAL
     134#endif
     135                        errno = EFTYPE;
    119136                        return -1;
    120137                }
    121138        }
     
    188205        cdf_stream_t sst, scn;
    189206        cdf_dir_t dir;
    190207        int i;
     208        const char *expn = "";
    191209        (void)&nbytes;
    192210        (void)&buf;
    193211
     
    200218#endif
    201219
    202220        if (cdf_read_sat(fd, &h, &sat) == -1) {
    203                 file_error(ms, errno, "Can't read SAT");
     221                expn = "Can't read SAT";
    204222                return -1;
    205223        }
    206224#ifdef CDF_DEBUG
     
    208226#endif
    209227
    210228        if ((i = cdf_read_ssat(fd, &h, &sat, &ssat)) == -1) {
    211                 file_error(ms, errno, "Can't read SAT");
     229                expn = "Can't read SSAT";
    212230                goto out1;
    213231        }
    214232#ifdef CDF_DEBUG
     
    216234#endif
    217235
    218236        if ((i = cdf_read_dir(fd, &h, &sat, &dir)) == -1) {
    219                 file_error(ms, errno, "Can't read directory");
     237                expn = "Can't read directory";
    220238                goto out2;
    221239        }
    222240
    223241        if ((i = cdf_read_short_stream(fd, &h, &sat, &dir, &sst)) == -1) {
    224                 file_error(ms, errno, "Cannot read short stream");
     242                expn = "Cannot read short stream";
    225243                goto out3;
    226244        }
    227245
     
    230248#endif
    231249        if ((i = cdf_read_summary_info(fd, &h, &sat, &ssat, &sst, &dir, &scn))
    232250            == -1) {
    233                 /* Some files don't have summary info! */
    234 #ifdef notyet
    235                 file_error(ms, errno, "Can't read summary_info");
    236 #else
    237                 i = 0;
    238 #endif
     251                expn = "";
    239252                goto out4;
    240253        }
    241254#ifdef CDF_DEBUG
    242255        cdf_dump_summary_info(&h, &scn);
    243256#endif
    244257        if ((i = cdf_file_summary_info(ms, &scn)) == -1)
    245                 file_error(ms, errno, "Can't expand summary_info");
     258                expn = "Can't expand summary_info";
    246259        free(scn.sst_tab);
    247260out4:
    248261        free(sst.sst_tab);
     
    252265        free(ssat.sat_tab);
    253266out1:
    254267        free(sat.sat_tab);
     268        if (i != 1) {
     269                if (file_printf(ms, "CDF V2 Document") == -1)
     270                        return -1;
     271                if (*expn)
     272                        if (file_printf(ms, ", corrupt: %s", expn) == -1)
     273                                return -1;
     274                i = 1;
     275        }
    255276        return i;
    256277}
Note: See TracBrowser for help on using the repository browser.