- Add debug santity checks

- Do not request peer creds anymore once we have them.
This commit is contained in:
manu 2010-09-20 06:45:38 +00:00
parent 60f1aed415
commit 7ba588b3fb
2 changed files with 25 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: msg.c,v 1.6 2010/09/15 01:51:44 manu Exp $ */
/* $NetBSD: msg.c,v 1.7 2010/09/20 06:45:38 manu Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@ -483,7 +483,6 @@ perfuse_readframe(pu, pufbuf, fd, done)
#if (PERFUSE_SOCKTYPE == SOCK_DGRAM)
peek = MSG_PEEK;
#endif
offset = puffs_framebuf_telloff(pufbuf);
/*
@ -509,6 +508,11 @@ perfuse_readframe(pu, pufbuf, fd, done)
/* NOTREACHED */
break;
default:
#if defined(PERFUSE_DEBUG) && (PERFUSE_SOCKTYPE == SOCK_DGRAM)
if (readen != remain)
DERRX(EX_SOFTWARE, "%s: short recv %zd/%zd",
__func__, readen, remain);
#endif
break;
}
@ -566,6 +570,11 @@ perfuse_readframe(pu, pufbuf, fd, done)
/* NOTREACHED */
break;
default:
#if defined(PERFUSE_DEBUG) && (PERFUSE_SOCKTYPE == SOCK_DGRAM)
if (readen != remain)
DERRX(EX_SOFTWARE, "%s: short recv %zd/%zd",
__func__, readen, remain);
#endif
break;
}
@ -615,6 +624,11 @@ perfuse_writeframe(pu, pufbuf, fd, done)
/* NOTREACHED */
break;
default:
#if defined(PERFUSE_DEBUG) && (PERFUSE_SOCKTYPE == SOCK_DGRAM)
if (written != remain)
DERRX(EX_SOFTWARE, "%s: short send %zd/%zd",
__func__, written, remain);
#endif
break;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: perfused.c,v 1.8 2010/09/15 01:51:44 manu Exp $ */
/* $NetBSD: perfused.c,v 1.9 2010/09/20 06:45:38 manu Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@ -100,6 +100,7 @@ get_mount_info(fd, pmi)
{
struct perfuse_mount_out *pmo;
struct sockcred cred;
int opt;
char *cp;
char *source = NULL;
char *target = NULL;
@ -117,6 +118,13 @@ get_mount_info(fd, pmi)
exit(EX_PROTOCOL);
}
/*
* We do not need peer creds beyond this point
*/
opt = 0;
if (setsockopt(fd, 0, LOCAL_CREDS, &opt, sizeof(opt)) != 0)
DWARN("%s: setsockopt LOCAL_CREDS failed", __func__);
#ifdef PERFUSE_DEBUG
if (perfuse_diagflags & PDF_MISC)
DPRINTF("perfuse lengths: source = %"PRId32", "