Changeset 2718

Show
Ignore:
Timestamp:
06/16/08 13:32:49 (5 months ago)
Author:
dhozac
Message:

On failure, mmap returns MAP_FAILED, not 0.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib_internal/unify-copy.c

    r2544 r2718  
    133133      if (buf_size > MMAP_BLOCKSIZE) buf_size = MMAP_BLOCKSIZE; 
    134134       
    135       if ((in_buf  = mmap(0, buf_size, PROT_READ,  MAP_SHARED,  in_fd, offset))==0 || 
    136           (out_buf = mmap(0, buf_size, PROT_WRITE, MAP_SHARED, out_fd, offset))==0) { 
     135      if ((in_buf  = mmap(0, buf_size, PROT_READ,  MAP_SHARED,  in_fd, offset))==MAP_FAILED || 
     136          (out_buf = mmap(0, buf_size, PROT_WRITE, MAP_SHARED, out_fd, offset))==MAP_FAILED) { 
    137137        perror("mmap()"); 
    138138        goto out; 
  • trunk/src/check-unixfile.c

    r1814 r2718  
    7474  else if (l>0) { 
    7575    data = mmap(0, l, PROT_READ, MAP_PRIVATE, fd, 0); 
    76     if (data==0) { 
     76    if (data==MAP_FAILED) { 
    7777      perror("mmap()"); 
    7878      exit(wrapper_exit_code); 
  • trunk/src/h2ext.c

    r2674 r2718  
    149149  Efstat(fd, &st); 
    150150  mapping = mmap(NULL, MIN(st.st_size, MAX_PEEK_SIZE), PROT_READ, MAP_SHARED, fd, 0); 
    151   if (!mapping) { 
     151  if (mapping == MAP_FAILED) { 
    152152    perror("mmap()"); 
    153153    Eclose(fd); 
  • trunk/src/testsuite/hashcalc-plain.c

    r2685 r2718  
    7777    if (buf_size>HASH_BLOCKSIZE) buf_size = HASH_BLOCKSIZE; 
    7878 
    79     assert((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))!=0); 
     79    assert((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))!=MAP_FAILED); 
    8080    offset += buf_size; 
    8181    assert(ensc_crypto_hashctx_update(&hash_context, buf, buf_size)!=-1); 
  • trunk/src/vhashify.c

    r2685 r2718  
    333333      if (buf_size>HASH_BLOCKSIZE) buf_size = HASH_BLOCKSIZE; 
    334334 
    335       if ((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))==0) { 
     335      if ((buf=mmap(0, buf_size, PROT_READ, MAP_SHARED, fd, offset))==MAP_FAILED) { 
    336336        perror("mmap(<hash>)"); 
    337337        goto out;