[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [leafnode-list] Problem with texpire
Andre Noll <noll@xxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> same with me again. I took a closer look:
>
> bash > grep getxover texpire-sw.c
> if (!getxover(g->name)) {
> getxover(g->name);
> bash > grep getxover leafnode-2.0b8/leafnode.h
> int getxover( void ); /* set xoverinfo, return 0 on error, nonzero else */
>
> Shouldn't it be getxover() instead of getxover(g->name)?
Sort of. You need to chdir() into the proper
directory.
getxover(g->name);
should be:
chdirgroup(g->name, 0);
getxover();
BUT NOTE! I did not review if the old directory needs to be
restored. And what should happen if changing the directory/restoring the
xover info fails.
The paranoid, untested (may be overkill though) replacement version is
(abort is not optimal, but better dead than wreaking havoc)
{
int olddir = open(".", O_RDONLY|O_DIRECTORY);
if (olddir < 0) abort(); /* better: log error and die or continue */
if (!chdirgroup(g->name, 0)) abort(); /* dito */
if (!getxover()) abort(); /* dito */
if (fchdir(olddir) < 0) abort(); /* dito */
if (close(olddir) < 0) abort(); /* dito */
}
--
Matthias Andree
--
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list