*BSD News Article 30476


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msuinfo!agate!spool.mu.edu!howland.reston.ans.net!pipex!doc.ic.ac.uk!cs.city.ac.uk!news!njw
From: njw@cs.city.ac.uk (Nick Williams)
Newsgroups: comp.os.386bsd.questions
Subject: Re: ctwm 3.0
Date: 11 May 1994 09:53:23 GMT
Organization: Systems Architecture Research Centre, City University
Lines: 55
Message-ID: <NJW.94May11105325@wilma.cs.city.ac.uk>
References: <2qordl$e7c@wzv.win.tue.nl> <1994May11.080109.20519@olivetti.nl>
NNTP-Posting-Host: wilma.cs.city.ac.uk
In-reply-to: paulz@olivetti.nl's message of Wed, 11 May 1994 08:01:09 GMT


The problem is with the way the later versions of twm derivatives
incorrectly wait for child processes.
ctwm (and various other versions of twm) fork
off an m4 to preprocess the twmrc file.  You need to change parse.c to
correctly wait for the child process, by changing the code looking
like the following in parse.c (around line 235) [and no, I haven't posted a
context diff because I don't have any "clean" source to diff against,
and because this bug is in so many different versions of *twm] [the
format may look like a context diff, that's just the way I typed it.
I've no idea if it really is]:

*** parse.c
    if (twmrc) {
        int status;

        if (filename && cp != filename) {
            fprintf (stderr,
                     "%s:  unable to open twmrc file %s, using %s instead\n",
                     ProgramName, filename, cp);
        }
        status = doparse (twmFileInput, "file", cp);
        fclose (twmrc);
        return status;
    } else {

To the following:

+++ parse.c
    if (twmrc) {
        int status;
+        int ret;

        if (filename && cp != filename) {
            fprintf (stderr,
                     "%s:  unable to open twmrc file %s, using %s instead\n",
                     ProgramName, filename, cp);
        }
        status = doparse (twmFileInput, "file", cp);
        fclose (twmrc);
+       wait(&ret);
        return status;
    } else {


Basically, you need to add the wait(). Et voila.

-- 
Nick Williams, Systems Architecture Research Centre, City University, 
London, EC1V 0HB.  UK.

Web: http://web.cs.city.ac.uk/finger?njw
E-mail: njw@cs.city.ac.uk (MIME and ATK)
Work Telephone: +44 71 477 8551
Work Fax: +44 71 477 8587