This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/2] ldd: Make try_trace more robust and portable


On Thu, Nov 22, 2012 at 10:41:10PM -0500, P. J. McDermott wrote:
[...]
> +try_trace() {
> +  output=$(eval $add_env '"$@"' && printf 'x') && printf '%s' "${output%x}"

If the trace command would fail somewhere in the middle, its output will
be lost.  What about this variant?

try_trace() {
  local output rc
  output=$(eval $add_env '"$@"'; rc=$?; printf 'x'; exit $rc)
  rc=$?
  printf '%s' "${output%x}"
  return $rc
}


-- 
ldv

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]