* missing braces or wrong indent? @ 2019-05-11 18:04 ` Mikael Magnusson 2019-05-13 8:47 ` Peter Stephenson 0 siblings, 1 reply; 2+ messages in thread From: Mikael Magnusson @ 2019-05-11 18:04 UTC (permalink / raw) To: zsh-workers Just submitted a new coverity build and looked at some stuff it was unhappy about; this isn't one of them but what is going on here? clone.c::bin_clone 55 if (!pid) { clearjobtab(0); ppid = getppid(); mypid = getpid(); #ifdef HAVE_SETSID if (setsid() != mypid) zwarnnam(nam, "failed to create new session: %e", errno); #elif defined(TIOCNOTTY) if (ioctl(SHTTY, TIOCNOTTY, 0)) zwarnnam(*args, "%e", errno); setpgrp(0L, mypid); #endif dup2(ttyfd,0); This/these if statements look completely bogusly indented, but maybe it's also missing braces? I can't tell because I have no idea what it wants to accomplish. -- Mikael Magnusson ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: missing braces or wrong indent? 2019-05-11 18:04 ` missing braces or wrong indent? Mikael Magnusson @ 2019-05-13 8:47 ` Peter Stephenson 0 siblings, 0 replies; 2+ messages in thread From: Peter Stephenson @ 2019-05-13 8:47 UTC (permalink / raw) To: zsh-workers On Sat, 2019-05-11 at 20:04 +0200, Mikael Magnusson wrote: > Just submitted a new coverity build and looked at some stuff it was > unhappy about; this isn't one of them but what is going on here? > > clone.c::bin_clone > 55 > if (!pid) { > clearjobtab(0); > ppid = getppid(); > mypid = getpid(); > #ifdef HAVE_SETSID > if (setsid() != mypid) > zwarnnam(nam, "failed to create new session: %e", errno); > #elif defined(TIOCNOTTY) > if (ioctl(SHTTY, TIOCNOTTY, 0)) > zwarnnam(*args, "%e", errno); > setpgrp(0L, mypid); > #endif > dup2(ttyfd,0); > > This/these if statements look completely bogusly indented, but maybe > it's also missing braces? I can't tell because I have no idea what it > wants to accomplish. I'd guess just the indentation; I can't see why the setpgrp() would be particularly useful on failure. Alternatively, possibly there could even be an "else" before the setpgrp()? Presumably this is rarely compiled and even then the ioctl() doesn't usually fail so very hard to see the effect of. pws ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-05-13 8:48 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20190511180553epcas2p2115461224eb064782dcff498f1b57b74@epcas2p2.samsung.com> 2019-05-11 18:04 ` missing braces or wrong indent? Mikael Magnusson 2019-05-13 8:47 ` Peter Stephenson
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).