snp.c (42453) | snp.c (43301) |
---|---|
1/* 2 * Copyright (c) 1995 Ugen J.S.Antsilevich 3 * 4 * Redistribution and use in source forms, with and without modification, 5 * are permitted provided that this entire comment appears intact. 6 * 7 * Redistribution in binary form may occur without any restrictions. 8 * Obviously, it would be nice if you gave credit where credit is due --- 158 unchanged lines hidden (view full) --- 167 if ((snp->snp_flags & SNOOP_OFLOW) && (n < snp->snp_len)) { 168 snp->snp_flags &= ~SNOOP_OFLOW; 169 } 170 s = spltty(); 171 nblen = snp->snp_blen; 172 if (((nblen / 2) >= SNOOP_MINLEN) && (nblen / 2) >= snp->snp_len) { 173 while (((nblen / 2) >= snp->snp_len) && ((nblen / 2) >= SNOOP_MINLEN)) 174 nblen = nblen / 2; | 1/* 2 * Copyright (c) 1995 Ugen J.S.Antsilevich 3 * 4 * Redistribution and use in source forms, with and without modification, 5 * are permitted provided that this entire comment appears intact. 6 * 7 * Redistribution in binary form may occur without any restrictions. 8 * Obviously, it would be nice if you gave credit where credit is due --- 158 unchanged lines hidden (view full) --- 167 if ((snp->snp_flags & SNOOP_OFLOW) && (n < snp->snp_len)) { 168 snp->snp_flags &= ~SNOOP_OFLOW; 169 } 170 s = spltty(); 171 nblen = snp->snp_blen; 172 if (((nblen / 2) >= SNOOP_MINLEN) && (nblen / 2) >= snp->snp_len) { 173 while (((nblen / 2) >= snp->snp_len) && ((nblen / 2) >= SNOOP_MINLEN)) 174 nblen = nblen / 2; |
175 if (nbuf = malloc(nblen, M_TTYS, M_NOWAIT)) { | 175 if ((nbuf = malloc(nblen, M_TTYS, M_NOWAIT)) != NULL) { |
176 bcopy(snp->snp_buf + snp->snp_base, nbuf, snp->snp_len); 177 free(snp->snp_buf, M_TTYS); 178 snp->snp_buf = nbuf; 179 snp->snp_blen = nblen; 180 snp->snp_base = 0; 181 } 182 } 183 splx(s); --- 102 unchanged lines hidden (view full) --- 286snpopen(dev, flag, mode, p) 287 dev_t dev; 288 int flag, mode; 289 struct proc *p; 290{ 291 struct snoop *snp; 292 register int unit, error; 293 | 176 bcopy(snp->snp_buf + snp->snp_base, nbuf, snp->snp_len); 177 free(snp->snp_buf, M_TTYS); 178 snp->snp_buf = nbuf; 179 snp->snp_blen = nblen; 180 snp->snp_base = 0; 181 } 182 } 183 splx(s); --- 102 unchanged lines hidden (view full) --- 286snpopen(dev, flag, mode, p) 287 dev_t dev; 288 int flag, mode; 289 struct proc *p; 290{ 291 struct snoop *snp; 292 register int unit, error; 293 |
294 if (error = suser(p->p_ucred, &p->p_acflag)) | 294 if ((error = suser(p->p_ucred, &p->p_acflag)) != 0) |
295 return (error); 296 297 if ((unit = minor(dev)) >= NSNP) 298 return (ENXIO); 299 300 snp = &snoopsw[unit]; 301 302 if (snp->snp_flags & SNOOP_OPEN) --- 239 unchanged lines hidden --- | 295 return (error); 296 297 if ((unit = minor(dev)) >= NSNP) 298 return (ENXIO); 299 300 snp = &snoopsw[unit]; 301 302 if (snp->snp_flags & SNOOP_OPEN) --- 239 unchanged lines hidden --- |