Bug 244327 - usr.bin/xargs/xargs.c:653 omits variable check when checking for ENOENT
Summary: usr.bin/xargs/xargs.c:653 omits variable check when checking for ENOENT
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: Mark Johnston
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-02-23 00:44 UTC by thomas.duffy.99
Modified: 2020-04-10 01:38 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thomas.duffy.99 2020-02-23 00:44:59 UTC
In usr.bin/xargs/xargs.c, line 653:

cause_exit = ENOENT ? 127 : 126;

No variable is compared to ENOENT, so it always returns 127.  This should likely be:

cause_exit = errno == ENOENT ? 127 : 126;
Comment 1 commit-hook freebsd_committer 2020-04-03 14:12:24 UTC
A commit references this bug:

Author: markj
Date: Fri Apr  3 14:03:59 UTC 2020
New revision: 359596
URL: https://svnweb.freebsd.org/changeset/base/359596

Log:
  xargs: Fix exit status expression when a child process fails to exec.

  PR:		244327
  Submitted by:	thomas.duffy.99@alumni.brown.edu
  MFC after:	1 week

Changes:
  head/usr.bin/xargs/xargs.c
Comment 2 Jilles Tjoelker freebsd_committer 2020-04-03 15:15:16 UTC
Looks good to me.
Comment 3 commit-hook freebsd_committer 2020-04-10 01:37:31 UTC
A commit references this bug:

Author: markj
Date: Fri Apr 10 01:37:00 UTC 2020
New revision: 359768
URL: https://svnweb.freebsd.org/changeset/base/359768

Log:
  MFC r359596:
  xargs: Fix exit status expression when a child process fails to exec.

  PR:	244327

Changes:
_U  stable/12/
  stable/12/usr.bin/xargs/xargs.c
Comment 4 Mark Johnston freebsd_committer 2020-04-10 01:38:49 UTC
Thanks for the patch.