emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/src/fileio.c


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/src/fileio.c
Date: Sat, 02 Jul 2005 04:15:51 -0400

Index: emacs/src/fileio.c
diff -c emacs/src/fileio.c:1.548 emacs/src/fileio.c:1.549
*** emacs/src/fileio.c:1.548    Sat Jun 25 22:37:49 2005
--- emacs/src/fileio.c  Sat Jul  2 08:15:51 2005
***************
*** 2521,2527 ****
       copyable by us. */
    input_file_statable_p = (fstat (ifd, &st) >= 0);
  
! #if !defined (DOS_NT) || __DJGPP__ > 1
    if (out_st.st_mode != 0
        && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
      {
--- 2521,2527 ----
       copyable by us. */
    input_file_statable_p = (fstat (ifd, &st) >= 0);
  
! #if !defined (MSDOS) || __DJGPP__ > 1
    if (out_st.st_mode != 0
        && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino)
      {
***************
*** 2574,2598 ****
        report_file_error ("I/O error", Fcons (newname, Qnil));
    immediate_quit = 0;
  
!   /* Preserve the owner and group, if requested.  */
!   if (input_file_statable_p && ! NILP (preserve_uid_gid))
!     fchown (ofd, st.st_uid, st.st_gid);
! 
    if (input_file_statable_p)
      {
! #ifndef MSDOS
        fchmod (ofd, st.st_mode & 07777);
- #else /* MSDOS */
- #if defined (__DJGPP__) && __DJGPP__ > 1
-       /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
-          and if it can't, it tells so.  Otherwise, under MSDOS we usually
-          get only the READ bit, which will make the copied file read-only,
-          so it's better not to chmod at all.  */
-       if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
-       chmod (SDATA (encoded_newname), st.st_mode & 07777);
- #endif /* DJGPP version 2 or newer */
- #endif /* MSDOS */
      }
  
    /* Closing the output clobbers the file times on some systems.  */
    if (emacs_close (ofd) < 0)
--- 2574,2589 ----
        report_file_error ("I/O error", Fcons (newname, Qnil));
    immediate_quit = 0;
  
! #ifndef MSDOS
!   /* Preserve the original file modes, and if requested, also its
!      owner and group.  */
    if (input_file_statable_p)
      {
!       if (! NILP (preserve_uid_gid))
!       fchown (ofd, st.st_uid, st.st_gid);
        fchmod (ofd, st.st_mode & 07777);
      }
+ #endif        /* not MSDOS */
  
    /* Closing the output clobbers the file times on some systems.  */
    if (emacs_close (ofd) < 0)
***************
*** 2614,2620 ****
      }
  
    emacs_close (ifd);
! #endif /* WINDOWSNT */
  
    /* Discard the unwind protects.  */
    specpdl_ptr = specpdl + count;
--- 2605,2623 ----
      }
  
    emacs_close (ifd);
! 
! #if defined (__DJGPP__) && __DJGPP__ > 1
!   if (input_file_statable_p)
!     {
!       /* In DJGPP v2.0 and later, fstat usually returns true file mode bits,
!          and if it can't, it tells so.  Otherwise, under MSDOS we usually
!          get only the READ bit, which will make the copied file read-only,
!          so it's better not to chmod at all.  */
!       if ((_djstat_flags & _STFAIL_WRITEBIT) == 0)
!       chmod (SDATA (encoded_newname), st.st_mode & 07777);
!     }
! #endif /* DJGPP version 2 or newer */
! #endif /* not WINDOWSNT */
  
    /* Discard the unwind protects.  */
    specpdl_ptr = specpdl + count;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]