(k_hasafs_recheck): new function, allow rechecking if AFS client have

started now, internaly it resets the internal state from k_hasafs()
and retry retry the probing. The problem with calling k_hasaf() is
that is plays around with signals, and that cases problem for some
systems/applications.


git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@16199 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-10-20 14:52:18 +00:00
parent ffd449e518
commit 156ee39478

View File

@@ -164,11 +164,38 @@ map_syscall_name_to_number (const char *str, int *res)
static int
try_ioctlpath(const char *path, int entrypoint)
{
int fd;
int fd, ret, saved_errno;
fd = open(path, O_RDWR);
if (fd < 0)
return 1;
switch (entrypoint) {
case LINUX_PROC_POINT: {
struct procdata data = { 0, 0, 0, 0, AFSCALL_PIOCTL };
data.param2 = (unsigned long)VIOCGETTOK;
ret = ioctl(fd, VIOC_SYSCALL_PROC, &data);
break;
}
case MACOS_DEV_POINT: {
struct devdata data = { AFSCALL_PIOCTL, 0, 0, 0, 0, 0, 0, 0 };
data.param2 = (unsigned long)VIOCGETTOK;
ret = ioctl(fd, VIOC_SYSCALL_DEV, &data);
break;
}
default:
abort();
}
saved_errno = errno;
close(fd);
/*
* Be quite liberal in what error are ok, the first is the one
* that should trigger given that params is NULL.
*/
if (ret &&
(saved_errno != EFAULT &&
saved_errno != EDOM &&
saved_errno != ENOTCONN))
return 1;
afs_ioctlpath = strdup(path);
if (afs_ioctlpath == NULL)
return 1;
@@ -545,3 +572,10 @@ done:
errno = saved_errno;
return afs_entry_point != NO_ENTRY_POINT;
}
int
k_hasafs_recheck(void)
{
afs_entry_point = UNKNOWN_ENTRY_POINT;
return k_hasafs();
}