~ubuntu-branches/ubuntu/raring/unrar-nonfree/raring-proposed

« back to all changes in this revision

Viewing changes to arcread.cpp

  • Committer: Package Import Robot
  • Author(s): Martin Meredith
  • Date: 2012-02-14 22:39:32 UTC
  • mfrom: (1.2.12)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: package-import@ubuntu.com-20120214223932-80w6cf6q639kinh4
Tags: upstream-4.1.4
ImportĀ upstreamĀ versionĀ 4.1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
 
45
45
size_t Archive::ReadHeader()
46
46
{
 
47
  // Once we failed to decrypt an encrypted block, there is no reason to
 
48
  // attempt to do it further. We'll never be successful and only generate
 
49
  // endless errors.
 
50
  if (FailedHeaderDecryption)
 
51
    return 0;
 
52
 
47
53
  CurBlockPos=Tell();
48
54
 
49
55
#ifndef SFX_MODULE
57
63
 
58
64
  if (Decrypt)
59
65
  {
60
 
#if defined(SHELL_EXT) || defined(NOCRYPT)
 
66
#if defined(SHELL_EXT) || defined(RAR_NOCRYPT)
61
67
    return(0);
62
68
#else
63
69
    if (Read(HeadersSalt,SALT_SIZE)!=SALT_SIZE)
185
191
        hd->FullUnpSize=INT32TO64(hd->HighUnpSize,hd->UnpSize);
186
192
 
187
193
        char FileName[NM*4];
188
 
        int NameSize=Min(hd->NameSize,sizeof(FileName)-1);
 
194
        size_t NameSize=Min(hd->NameSize,sizeof(FileName)-1);
189
195
        Raw.Get((byte *)FileName,NameSize);
190
196
        FileName[NameSize]=0;
191
197
 
426
432
#ifndef SILENT
427
433
        Log(FileName,St(MEncrBadCRC),FileName);
428
434
#endif
429
 
        Close();
430
 
 
 
435
//        Close();
 
436
        FailedHeaderDecryption=true;
431
437
        BrokenFileHeader=true;
 
438
 
432
439
        ErrHandler.SetErrorCode(CRC_ERROR);
433
440
        return(0);
434
 
//        ErrHandler.Exit(CRC_ERROR);
435
441
      }
436
442
    }
437
443
  }
573
579
#endif
574
580
#ifdef _UNIX
575
581
  // umask defines which permission bits must not be set by default
576
 
  // when creating a file or directory.
 
582
  // when creating a file or directory. The typical default value
 
583
  // for the process umask is S_IWGRP | S_IWOTH (octal 022),
 
584
  // resulting in 0644 mode for new files.
577
585
  static mode_t mask = (mode_t) -1;
578
586
 
579
587
  if (mask == (mode_t) -1)
580
588
  {
581
589
    // umask call returns the current umask value. Argument (022) is not 
582
 
    // important here.
 
590
    // really important here.
583
591
    mask = umask(022);
584
592
 
585
593
    // Restore the original umask value, which was changed to 022 above.