mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-08-18 15:26:05 +00:00
Be a bit more consistent about comparing to zero
* src/buffer.c (xclose, archive_is_dev, close_archive) (write_fatal_details, init_volume_number) (closeout_volume_number, new_volume, try_new_volume): * src/checkpoint.c (format_checkpoint_string): * src/compare.c (process_rawdata, diff_file, diff_dumpdir): * src/create.c (create_archive, restore_parent_fd, dump_file0): * src/delete.c (delete_archive_members): * src/exclist.c (cvs_addfn): * src/extract.c (set_mode, mark_after_links, delay_set_stat) (repair_delayed_set_stat, make_directories, file_newer_p) (maybe_recoverable, apply_nonancestor_delayed_set_stat) (extract_dir, open_output_file, find_delayed_link_source) (create_placeholder_file, extract_symlink, extract_node) (extract_fifo, apply_delayed_link): * src/incremen.c (update_parent_directory, scan_directory) (read_obstack, read_incr_db_2, write_directory_file) (try_purge_directory): * src/map.c (map_read): * src/misc.c (maybe_backup_file, undo_last_backup, chdir_do) (tar_savedir): * src/names.c (handle_file_selection_option, add_file_id) (handle_option, read_next_name, add_hierarchy_to_namelist) (collect_and_sort_names): * src/system.c (run_decompress_program, dec_to_env, time_to_env) (oct_to_env, str_to_env, chr_to_env, sys_exec_setmtime_script): * src/tar.c (get_date_or_file, parse_default_options) (decode_options, main): * src/unlink.c (flush_deferred_unlinks): * src/update.c (append_file): * src/xattrs.c (xattrs__acls_set, xattrs_xattrs_set): Prefer < 0 when looking at syscalls; prefer != 0 to nothing when testing an integer in a boolean context. This is for style, not substance; for example, it’s easier to read ‘if (wordsplit (...) != WRDSE_OK) ...’ than ‘if (wordsplit (...)) ...’ if you don’t already know that wordsplit returns an enum rather than bool. * src/names.c (add_file_id, read_next_name, regex_usage_warning): * src/transform.c (parse_xform_flags): Return bool not int, possibly inverting sense so that true means OK. All callers changed. * src/tar.c (main): Report errno info if stdopen fails.
This commit is contained in:
+3
-3
@@ -106,7 +106,7 @@ flush_deferred_unlinks (bool force)
|
||||
else
|
||||
fname = p->file_name;
|
||||
|
||||
if (unlinkat (chdir_fd, fname, AT_REMOVEDIR) != 0)
|
||||
if (unlinkat (chdir_fd, fname, AT_REMOVEDIR) < 0)
|
||||
{
|
||||
switch (errno)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ flush_deferred_unlinks (bool force)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (unlinkat (chdir_fd, p->file_name, 0) != 0 && errno != ENOENT)
|
||||
if (unlinkat (chdir_fd, p->file_name, 0) < 0 && errno != ENOENT)
|
||||
unlink_error (p->file_name);
|
||||
}
|
||||
dunlink_reclaim (p);
|
||||
@@ -166,7 +166,7 @@ flush_deferred_unlinks (bool force)
|
||||
else
|
||||
fname = p->file_name;
|
||||
|
||||
if (unlinkat (chdir_fd, fname, AT_REMOVEDIR) != 0)
|
||||
if (unlinkat (chdir_fd, fname, AT_REMOVEDIR) < 0)
|
||||
{
|
||||
if (errno != ENOENT)
|
||||
rmdir_error (fname);
|
||||
|
||||
Reference in New Issue
Block a user