CONN FAILED (DEVICE LOCKED) - HDB

Richard Stueven gak at gakbox.Corp.Sun.COM
Fri Jun 21 06:28:05 AEST 1991


In article <455.28605DC6 at mcws.fidonet.org>, BHeess at mcws.fidonet.org (Brian Heess) writes:
|>
|> uucp mcws  (6/19-23:24:52,99,0) CONN FAILED (DEVICE LOCKED)

I've seen this happen a lot.  When an incoming call disconnects, often the
lock file does not get removed.  I wrote a small program, "uuunlock.c", that
validates the lock file(s) and removes them if they're invalid.  Since it's
a short program, I'll include it here rather than posting to the source group.

==============================================================================
#include <stdio.h>
#include <fcntl.h>

char *ulockf[] = {
    "/usr/spool/uucp/LCK..ph1"
};
#define NULOCKF 1

main(argc,argv)
int argc;
char **argv;
{
    int i, fd;
    long uucppid;
    char errbuff[512];

    for (i = 0; i < NULOCKF; i++) {
        if ((fd = open(ulockf[i],O_RDONLY)) == -1) {
            sprintf(errbuff,"Can't open %s",ulockf[i]);
            perror(errbuff);
        } else if (read(fd,&uucppid,sizeof(uucppid)) == -1) {
            perror("read error");
        } else {
            close(fd);
            if (kill((int)uucppid,0) == -1) {
                if (unlink(ulockf[i]) == -1) {
                    sprintf(errbuff,"Can't unlink %s",ulockf[i]);
                    perror(errbuff);
                }
            } else {
                sprintf(errbuff,"kill -0 %d failed",(int)uucppid);
                perror(errbuff);
            }
        }
    }
}
================================================================================
-- 
I guess there's some things          |      Seems like the more I think I know
I'm not meant to understand          |                 The more I find I don't
Ain't life a riot? Ain't love grand? | Every answer opens up so many questions
Richard Stueven                gak at Corp.Sun.COM                ...!attmail!gak



More information about the Comp.sys.3b1 mailing list