devfs
[Top] [All Lists]

Re: patch for annoying symlink warnings

To: Greg Ward <gward@xxxxxxxxxx>
Subject: Re: patch for annoying symlink warnings
From: Russell Coker <russell@xxxxxxxxxxxx>
Date: Fri, 26 Oct 2001 14:11:03 +0200
Cc: devfs@xxxxxxxxxxx
In-reply-to: <20011024171459.A20660@xxxxxxx>
References: <20011024202208.1288A3836C2@xxxxxxxxxxxxxxxxx> <20011024171459.A20660@xxxxxxx>
Reply-to: Russell Coker <russell@xxxxxxxxxxxx>
Sender: owner-devfs@xxxxxxxxxxx
On Wed, 24 Oct 2001 23:14, Greg Ward wrote:
> > +    if(lstat(oldpath, &buf))
> > +    {
> > +   SYSLOG(LOG_ERR, "Link destination \"%s\" doesn't exist.", oldpath);
> > +   return 0;
> > +    }
>
> This is subtly different from the semantics of the standard symlink():
> it bars you from creating dangling symlinks at all.  I can envision
> circumstances where this is useful, but I agree that it should produce a
> warning.  How about downgrading this to a warning (does LOG_WARN
> exist?), and allowing the (dangling) link to be created anyways?

OK.  The "GLOBAL symlink" operation is generally triggered by a REGISTER 
event.  The normal operation of a register event is to link to the newly 
created device.  So I can't imagine the automatic creation of a broken 
symlink to be anything other than a serious error.

> > +    if(symlink(oldpath, newpath))
> > +    {
> > [...]
> > +   SYSLOG(LOG_ERR, "Link \"%s\" to \"%s\" gives error %m.\n", oldpath,
> > newpath);
>
> If "%m" expands to strerror(errno), I only have one comment about this:
> it could be tightened up a bit, eg.:
>
>   SYSLOG(LOG_ERR, "symlink \"%s\" to \"%s\": error: %m\n", oldpath,
> newpath);

OK.  There's a bug in that bit of code.  It uses "%m" after doing some other 
system calls (so the error may be different).  I've fixed that by repeating 
the symlink attempt before logging the error.

-- 
http://www.coker.com.au/bonnie++/     Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/       Postal SMTP/POP benchmark
http://www.coker.com.au/projects.html Projects I am working on
http://www.coker.com.au/~russell/     My home page


<Prev in Thread] Current Thread [Next in Thread>