devfs
[Top] [All Lists]

Re: patch for annoying symlink warnings

To: Russell Coker <russell@xxxxxxxxxxxx>
Subject: Re: patch for annoying symlink warnings
From: Greg Ward <gward@xxxxxxxxxx>
Date: Wed, 24 Oct 2001 17:14:59 -0400
Cc: devfs@xxxxxxxxxxx
In-reply-to: <20011024202208.1288A3836C2@xxxxxxxxxxxxxxxxx>
References: <20011024202208.1288A3836C2@xxxxxxxxxxxxxxxxx>
Sender: owner-devfs@xxxxxxxxxxx
User-agent: Mutt/1.3.22i
On 24 October 2001, Russell Coker said:
> error calling: "symlink" in "GLOBAL"
> error calling: "symlink" in "GLOBAL"
> error calling: "symlink" in "GLOBAL"
> 
> When you do "killall -1 devfsd" to reload the config you often see errors 
> such as the above.  These are because of "CFUNCTION GLOBAL symlink" events 
> trying to create the link a second time.

So I'm not the only one who's bugged by this!

> I have attached a patch that fixes this issue.

Great!  Even though I'm an innocent bystander and have only been using
devfs for a few weeks, I still have a few comments.  ;-)

> +    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?

> +    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);

Minor quibble.

        Greg
-- 
Greg Ward - Linux geek                                  gward@xxxxxxxxxx
http://starship.python.net/~gward/
A day for firm decisions!!!!!  Or is it?

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