From c3629dc5093a87303041fcffe95a6de02891c71a Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Thu, 30 Jan 1992 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1992-01-30 --- port/devdk.c | 5 ++++- port/ipdat.h | 2 +- port/swap.c | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/port/devdk.c b/port/devdk.c index 1b7a92eb0d2709bda584f5de930892d343924e92..866030f74937e5f598e66047efbdbd18d869ba0c 100644 --- a/port/devdk.c +++ b/port/devdk.c @@ -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) diff --git a/port/ipdat.h b/port/ipdat.h index f110b2b1c0300d5bccbacc7d41e7c6a1ae90ba6e..904aede2e78aff485c4b770b04cb63475ef2feee 100644 --- a/port/ipdat.h +++ b/port/ipdat.h @@ -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 diff --git a/port/swap.c b/port/swap.c index 2660336285d4ed040ead6b2f59d1e1e9488ec307..132d09b2e344100a014073588db118cd97e66213 100644 --- a/port/swap.c +++ b/port/swap.c @@ -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);