From e05ece2cedb3396d494f67f14a9bcb343d2b6cf0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 3 Jul 2005 07:27:05 +0000 Subject: Cleanup to isolate "safer" functions to a small part of the code. --- ChangeLog | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- lib/ChangeLog | 24 +++++++++++++++++++++ m4/ChangeLog | 7 ++++++ 3 files changed, 99 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e77e8d8d7..ec574bd86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,74 @@ -2005-07-02 Jim Meyering +2005-07-02 Paul Eggert * Version 5.3.1. + Cleanup to isolate "safer" functions to a small part of the code. + * src/comm.c: Include stdio--.h, not stdio-safer.h. + (compare_files): Use fopen, not fopen_safer. + * src/copy.c: Include fcntl--.h, not unistd-safer.h. + (copy_reg): Don't call fd_safer; no longer needed + now that we include fcntl--.h. + * src/csplit.c: Include fd-reopen.h. + Include stdio--.h, not stdio-safer.h. + (input_desc): Remove. All uses changed to STDIN_FILENO. + (set_input_file): Reopen stdin, to simplify code. + (create_output_file): Use fopen, not fopen_safer. + * src/dd.c: Include fd-reopen.h. + (open_fd): Remove. All callers changed to use fd_reopen instead. + * src/join.c: Include stdio--.h, not stdio-safer.h. + (main): Use fopen, not fopen_safer. + * src/md5sum.c: Include stdio--.h. + (digest_check): Don't try to read both checksums and data from stdin. + * src/nohup.c: Include fd-reopen.h. + Include unistd--.h, not unistd-safer.h. + (main): Use fd_reopen to simplify code. When replacing stdin, + use "/dev/null" not "/", as that's less likely to go wrong these days. + (main): Use dup, not dup_safer. + * src/pr.c: Include stdio--.h, not stdio-safer.h. + (open_file): Invoke fopen, not fopen_safer. + * src/shred.c: Include fcntl--.h, not unistd-safer.h. + (wipename, wipe_file): Don't use fd_safer; no longer needed + now that we include fcntl--.h. + * src/sort.c: Include stdio--.h rather than stdio-safer.h. + Include stdlib--.h. Do not include unistd-safer.h. + (create_temp_file): Don't call fd_safer; no longer needed + now that we include *--.h files. + (xfopen): Don't call fopen_safer, for similar reasons. + * src/split.c: Include fcntl--.h rather than unistd-safer.h. + Include fd-reopen.h. + (input_desc): Remove. All uses replaced by STDIN_FILENO. + (cwrite): Don't call fd_safer; no longer needed now that + we include fcntl--.h. + (main): Reuse stdin rather than opening a new one. This + saves a file descriptor. + * src/stty.c: Include fd-reopen.h. + (display_all, display_settings, display_window_size, set_window_size): + Remove fd arg, since we now assume stdin. All callers changed. + (main): Reuse stdin rather than opening a new one. This + saves a file descriptor. + * src/tac.c: Include stdlib--.h rather than unistd-safer.h. + (copy_to_temp): Don't call fd_safer; no longer needed now + that we include stdlib--.h. + * src/tail.c: Include fcntl--.h, not unistd-safer.h. + (recheck, tail_file): Don't call fd_safer; no longer needed + now that we include fcntl--.h. + * src/tee.c: Include stdio--.h, not stdio-safer.h. + (tee): Don't call fopen_safer; no longer needed now that we + include stdio--.h. + * src/touch.c: Include fcntl--.h, not unistd-safer.h. + (touch): Don't call fd_safer; no longer needed now that + we include fcntl--.h. + + * src/du.c (main): Reuse stdin rather than opening a new stream. + This saves a file descriptor. + * src/uniq.c: Don't include stdio-safer.h; no longer needed. + (writeline): Remove stream arg; we now always output to stdout. + All callers changed. + (check_file): Reuse stdout rather than opening a new stream. + This saves a file descriptor. + +2005-07-02 Jim Meyering + * Makefile.maint (sc_obsolete_symbols): New rule. (syntax-check-rules): Add it to the list. * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols. diff --git a/lib/ChangeLog b/lib/ChangeLog index 8b56cbf54..94180dc66 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,27 @@ +2005-07-02 Paul Eggert + + Cleanup to isolate "safer" functions to a small part of the code. + * fcntl--.h, stdio--.h, stdlib--.h, unistd--.h, fcntl-safer.h: + * open-safer.c, stdlib-safer.h, mkstemp-safer.c, fd-reopen.h: + * fd-reopen.c: New files. + * fopen-safer.c: Include stdio-safer.h first, to check interface. + Don't bother including stdio.h, since stdio-safer.h does. + * fts.c (fd_safer): Remove decl. + Include fcntl--.h rather than unistd-safer.h + (fts_safe_changedir): Don't call fd_safer; no longer needed + now that we include fcntl--.h. + * getloadavg.c: Include fcntl--.h rather than fcntl.h. + Do not include unistd-safer.h. + (getloadavg): Don't call fd_safer; no longer needed + now that we include fcntl--.h. + * getusershell.c: Include stdio--.h rather than stdio.h + and stdio-safer.h. + (getusershell): Call fopen, not fopen_safer. + * save-cwd.c: Include fcntl--.h rather than fcntl.h. + Do not include unistd-safer.h. + (save_cwd): Don't call fd_safer; no longer needed + now that we include fcntl--.h. + 2005-07-02 Jim Meyering * getopt_.h: Assume HAVE_UNISTD_H, i.e., include diff --git a/m4/ChangeLog b/m4/ChangeLog index ca47e828e..c3de0057f 100644 --- a/m4/ChangeLog +++ b/m4/ChangeLog @@ -1,3 +1,10 @@ +2005-07-02 Paul Eggert + + Cleanup to isolate "safer" functions to a small part of the code. + * fcntl-safer.m4, fd-reopen.m4, stdlib-safer.m4: New files. + * prereq.m4 (gl_PREREQ): Require gl_FCNTL_SAFER, + gl_FD_REOPEN, gl_STDLIB_SAFER. + 2005-07-02 Jim Meyering * check-decl.m4, chown.m4, free.m4, getcwd.m4, link-follow.m4: -- cgit v1.2.3-70-g09d2