all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ken Brown <kbrown@cornell.edu>
Cc: 55153@debbugs.gnu.org
Subject: bug#55153: 29.0.50; Implement system_process_attributes on Cygwin
Date: Wed, 27 Apr 2022 18:52:58 +0300	[thread overview]
Message-ID: <83zgk6bk11.fsf@gnu.org> (raw)
In-Reply-To: <96920ef8-e5c6-0b9f-a8f4-b7e0b1c53328@cornell.edu> (message from Ken Brown on Wed, 27 Apr 2022 11:16:46 -0400)

> Date: Wed, 27 Apr 2022 11:16:46 -0400
> From: Ken Brown <kbrown@cornell.edu>
> 
> +# ifdef CYGWIN
> +  /* ttname */
> +  strcpy (procfn_end, "/ctty");
> +  fd = emacs_open (fn, O_RDONLY, 0);
> +  if (fd < 0)
> +    nread = 0;
> +  else
> +    {
> +      record_unwind_protect_int (close_file_unwind, fd);
> +      nread = emacs_read_quit (fd, procbuf, sizeof procbuf);
> +    }
> +  /* /proc/<pid>/ctty should always end in newline. */
> +  if (0 < nread && procbuf[nread - 1] == '\n')
> +    procbuf[nread - 1] = '\0';
> +  else
> +    procbuf[0] = '\0';
> +  attrs = Fcons (Fcons (Qttname, build_string (procbuf)), attrs);

Is what you read from /proc/<pid>/ctty guaranteed to be pure-ASCII
string?  If not, build_string is not the best idea here; you need to
produce a unibyte string and decode it.

Thanks.

P.S. Doesn't this warrant a NEWS entry?





  reply	other threads:[~2022-04-27 15:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-27 15:00 bug#55153: 29.0.50; Implement system_process_attributes on Cygwin Ken Brown
2022-04-27 15:16 ` Ken Brown
2022-04-27 15:52   ` Eli Zaretskii [this message]
2022-04-27 16:45     ` Ken Brown
2022-04-27 17:12       ` Eli Zaretskii
2022-04-27 17:25         ` Ken Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83zgk6bk11.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=55153@debbugs.gnu.org \
    --cc=kbrown@cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.