Mercurial > emacs
comparison src/fileio.c @ 83331:efa9e4606e7e
Merged from miles@gnu.org--gnu-2005 (patch 83-87, 449-468)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-449
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-450
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-451
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-452
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-453
Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix.
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-454
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-455
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-456
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-457
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-459
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-460
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-461
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-462
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-463
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-464
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-465
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-466
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-467
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-468
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-83
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-84
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-85
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-86
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-87
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-371
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Tue, 05 Jul 2005 22:12:55 +0000 |
parents | ebfb2856c8e6 2e6177253f28 |
children | 6c13700d1c13 |
comparison
equal
deleted
inserted
replaced
83330:233c9974025b | 83331:efa9e4606e7e |
---|---|
2521 | 2521 |
2522 /* We can only copy regular files and symbolic links. Other files are not | 2522 /* We can only copy regular files and symbolic links. Other files are not |
2523 copyable by us. */ | 2523 copyable by us. */ |
2524 input_file_statable_p = (fstat (ifd, &st) >= 0); | 2524 input_file_statable_p = (fstat (ifd, &st) >= 0); |
2525 | 2525 |
2526 #if !defined (DOS_NT) || __DJGPP__ > 1 | 2526 #if !defined (MSDOS) || __DJGPP__ > 1 |
2527 if (out_st.st_mode != 0 | 2527 if (out_st.st_mode != 0 |
2528 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) | 2528 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) |
2529 { | 2529 { |
2530 errno = 0; | 2530 errno = 0; |
2531 report_file_error ("Input and output files are the same", | 2531 report_file_error ("Input and output files are the same", |
2574 while ((n = emacs_read (ifd, buf, sizeof buf)) > 0) | 2574 while ((n = emacs_read (ifd, buf, sizeof buf)) > 0) |
2575 if (emacs_write (ofd, buf, n) != n) | 2575 if (emacs_write (ofd, buf, n) != n) |
2576 report_file_error ("I/O error", Fcons (newname, Qnil)); | 2576 report_file_error ("I/O error", Fcons (newname, Qnil)); |
2577 immediate_quit = 0; | 2577 immediate_quit = 0; |
2578 | 2578 |
2579 /* Preserve the owner and group, if requested. */ | 2579 #ifndef MSDOS |
2580 if (input_file_statable_p && ! NILP (preserve_uid_gid)) | 2580 /* Preserve the original file modes, and if requested, also its |
2581 fchown (ofd, st.st_uid, st.st_gid); | 2581 owner and group. */ |
2582 | |
2583 if (input_file_statable_p) | 2582 if (input_file_statable_p) |
2584 { | 2583 { |
2585 #ifndef MSDOS | 2584 if (! NILP (preserve_uid_gid)) |
2585 fchown (ofd, st.st_uid, st.st_gid); | |
2586 fchmod (ofd, st.st_mode & 07777); | 2586 fchmod (ofd, st.st_mode & 07777); |
2587 #else /* MSDOS */ | 2587 } |
2588 #if defined (__DJGPP__) && __DJGPP__ > 1 | 2588 #endif /* not MSDOS */ |
2589 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, | |
2590 and if it can't, it tells so. Otherwise, under MSDOS we usually | |
2591 get only the READ bit, which will make the copied file read-only, | |
2592 so it's better not to chmod at all. */ | |
2593 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) | |
2594 chmod (SDATA (encoded_newname), st.st_mode & 07777); | |
2595 #endif /* DJGPP version 2 or newer */ | |
2596 #endif /* MSDOS */ | |
2597 } | |
2598 | 2589 |
2599 /* Closing the output clobbers the file times on some systems. */ | 2590 /* Closing the output clobbers the file times on some systems. */ |
2600 if (emacs_close (ofd) < 0) | 2591 if (emacs_close (ofd) < 0) |
2601 report_file_error ("I/O error", Fcons (newname, Qnil)); | 2592 report_file_error ("I/O error", Fcons (newname, Qnil)); |
2602 | 2593 |
2614 Fcons (newname, Qnil))); | 2605 Fcons (newname, Qnil))); |
2615 } | 2606 } |
2616 } | 2607 } |
2617 | 2608 |
2618 emacs_close (ifd); | 2609 emacs_close (ifd); |
2619 #endif /* WINDOWSNT */ | 2610 |
2611 #if defined (__DJGPP__) && __DJGPP__ > 1 | |
2612 if (input_file_statable_p) | |
2613 { | |
2614 /* In DJGPP v2.0 and later, fstat usually returns true file mode bits, | |
2615 and if it can't, it tells so. Otherwise, under MSDOS we usually | |
2616 get only the READ bit, which will make the copied file read-only, | |
2617 so it's better not to chmod at all. */ | |
2618 if ((_djstat_flags & _STFAIL_WRITEBIT) == 0) | |
2619 chmod (SDATA (encoded_newname), st.st_mode & 07777); | |
2620 } | |
2621 #endif /* DJGPP version 2 or newer */ | |
2622 #endif /* not WINDOWSNT */ | |
2620 | 2623 |
2621 /* Discard the unwind protects. */ | 2624 /* Discard the unwind protects. */ |
2622 specpdl_ptr = specpdl + count; | 2625 specpdl_ptr = specpdl + count; |
2623 | 2626 |
2624 UNGCPRO; | 2627 UNGCPRO; |