diff --git a/src/main.c b/src/main.c index a82bbac4..4946bc89 100644 --- a/src/main.c +++ b/src/main.c @@ -798,6 +798,9 @@ int main(int argc, char *argv[]) { RptMaxCount = i; } + if (!*cp) + break; + if (*cp != LSOF_FID_MARK) { GOx1 = GObk[0]; GOx2 = GObk[1] + n; diff --git a/tests/case-20-repeat-count.bash b/tests/case-20-repeat-count.bash index 6962bc63..5b544685 100755 --- a/tests/case-20-repeat-count.bash +++ b/tests/case-20-repeat-count.bash @@ -16,4 +16,11 @@ if [ $(echo "$output" | grep -e '=======' | wc -l) != 5 ]; then exit 1 fi +# The count must not be parsed again as a -c option +output=$(${lsof} -r1c2 -a -p $$ -Fp) +echo "$output" >> $report +if [ $(echo "$output" | grep -e "^p$$\$" | wc -l) != 2 ]; then + exit 1 +fi + exit 0