Skip to content

Commit

Permalink
sh: fix the previous script cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sahib committed Jun 13, 2017
1 parent 97a55e6 commit 1f1c05e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/formats/sh.c.in
Expand Up @@ -249,7 +249,7 @@ static char *rm_fmt_sh_get_extra_equal_args(RmSession *session) {
if(cfg->follow_symlinks) {
g_string_append(buf, " --followlinks");
} else {
g_string_append(buf, " ---no-followlinks");
g_string_append(buf, " --no-followlinks");
}
}

Expand Down
15 changes: 8 additions & 7 deletions lib/formats/sh.sh
Expand Up @@ -110,14 +110,15 @@ handle_bad_user_and_group_id() {
###############################

check_for_equality() {
# Use the more lightweight builtin `cmp` for regular files:
if [ -f "$1" ]; then
return $(cmp -s "$1" "$2")
# Use the more lightweight builtin `cmp` for regular files:
cmp -s "$1" "$2"
echo $?
else
# Fallback to `rmlint --equal` for directories:
$RMLINT_BINARY -pp --equal $RMLINT_EQUAL_EXTRA_ARGS "$1" "$2"
echo $?
fi

# Fallback to `rmlint --equal` for directories:
$RMLINT_BINARY -p --equal $RMLINT_EQUAL_EXTRA_ARGS "$1" "$2"
return $?
}

original_check() {
Expand All @@ -141,7 +142,7 @@ original_check() {
if [ -z "$DO_PARANOID_CHECK" ]; then
return 0
else
if [ -n $(check_for_equality "$1" "$2")]; then
if [ $(check_for_equality "$1" "$2") -ne 0 ]; then
echo $COL_RED "^^^^^^ Error: files no longer identical - cancelling....." $COL_RESET
fi
fi
Expand Down

0 comments on commit 1f1c05e

Please sign in to comment.