[PATCH v6 6/6] linux ttyname and ttyname_r: Add tests

Florian Weimer fw@deneb.enyo.de
Sun Nov 12 09:21:00 GMT 2017


* Luke Shumaker:

> +/* returns a pointer to static storage */
> +static char *
> +xreadlink (const char *linkname)
> +{
> +  static char target[PATH_MAX+1];
> +  ssize_t target_len = readlink (linkname, target, PATH_MAX);
> +  VERIFY (target_len > 0);
> +  target_len = trim_prefix (target, target_len, "(unreachable)");
> +  target[target_len] = '\0';
> +  return target;
> +}

Please don't use x* names in this way in tests, they should go into
support/ as glibc function wrappers.  (I just added a different
implementation of xreadlink to support/.)



More information about the Libc-alpha mailing list