M port/devdk.c => port/devdk.c +4 -1
@@ 810,7 810,10 @@ dkwrite(Chan *c, void *a, long n, ulong offset)
* easier to do here than in dkoput
*/
if(t == Sctlqid){
- strncpy(buf, a, sizeof buf);
+ if(n > sizeof buf - 1)
+ n = sizeof buf - 1;
+ strncpy(buf, a, n);
+ buf[n] = '\0';
m = getfields(buf, field, 5, ' ');
if(strcmp(field[0], "connect")==0){
if(m < 2)
M port/ipdat.h => port/ipdat.h +1 -1
@@ 498,7 498,7 @@ int ipforme(uchar*);
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define BLKIP(xp) ((Etherhdr *)((xp)->rptr))
-#define BLKFRAG(xp) ((Ipfrag *)((xp)->rptr))
+#define BLKFRAG(xp) ((Ipfrag *)((xp)->base))
#define PREC(x) ((x)>>5 & 7)
#define WORKBUF 64
M port/swap.c => port/swap.c +4 -0
@@ 128,6 128,10 @@ pager(void *junk)
}
else
if(palloc.freecount < HIGHWATER) {
+ /* Rob made me do it ! */
+ if(conf.cntrlp == 0)
+ freebroken();
+
/* Emulate the old system if no swap channel */
print("no physical memory\n");
tsleep(&swapalloc.r, return0, 0, 1000);