Check-in [034819087d]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Make blob_read_link() C89-compatible on Unix again.
Timelines: family | ancestors | descendants | both | symlinks
Files: files | file ages | folders
SHA1:034819087de9ca37a52d696ce865f60b2943398c
User & Date: dmitry 2011-08-28 11:22:36
Context
2011-08-31
09:55
Merge latest trunk. check-in: 40ed431ca5 user: dmitry tags: symlinks
2011-08-28
11:22
Make blob_read_link() C89-compatible on Unix again. check-in: 034819087d user: dmitry tags: symlinks
11:01
Use file_delete() instead of unlink() in vfile_to_disk(). check-in: 08311ffc6a user: dmitry tags: symlinks
Changes

Changes to src/blob.c.

709
710
711
712
713
714
715
716
717
718
719
720
721
722
723

724
725
726

727
728
729
730
731
732
733
** Any prior content of the blob is discarded, not freed.
**
** Returns length of destination path.
**
** On windows, zeros blob and returns 0.
*/
int blob_read_link(Blob *pBlob, const char *zFilename){
  blob_zero(pBlob);
#if !defined(_WIN32)
  char zBuf[1024];
  ssize_t len = readlink(zFilename, zBuf, 1023);
  if( len < 0 ){
    fossil_panic("cannot read symbolic link %s", zFilename);
  }
  zBuf[len] = 0;   /* null-terminate */

  blob_appendf(pBlob, "%s", zBuf);
  return len;
#else

  return 0;
#endif
}


/*
** Write the content of a blob into a file.







<







>



>







709
710
711
712
713
714
715

716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
** Any prior content of the blob is discarded, not freed.
**
** Returns length of destination path.
**
** On windows, zeros blob and returns 0.
*/
int blob_read_link(Blob *pBlob, const char *zFilename){

#if !defined(_WIN32)
  char zBuf[1024];
  ssize_t len = readlink(zFilename, zBuf, 1023);
  if( len < 0 ){
    fossil_panic("cannot read symbolic link %s", zFilename);
  }
  zBuf[len] = 0;   /* null-terminate */
  blob_zero(pBlob);
  blob_appendf(pBlob, "%s", zBuf);
  return len;
#else
  blob_zero(pBlob);
  return 0;
#endif
}


/*
** Write the content of a blob into a file.