ia64/xen-unstable
changeset 47:34208c741acc
bitkeeper revision 1.7.1.9 (3dff745dQXvY5lV_SsLHnw3PlaxUMw)
robusify /proc/vfr parsing and xen Makefile tweak
robusify /proc/vfr parsing and xen Makefile tweak
author | smh22@boulderdash.cl.cam.ac.uk |
---|---|
date | Tue Dec 17 19:00:45 2002 +0000 (2002-12-17) |
parents | d421c8e84808 |
children | 5e3054a6afc0 |
files | xen-2.4.16/Makefile xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c |
line diff
1.1 --- a/xen-2.4.16/Makefile Mon Dec 16 11:50:19 2002 +0000 1.2 +++ b/xen-2.4.16/Makefile Tue Dec 17 19:00:45 2002 +0000 1.3 @@ -4,6 +4,7 @@ export BASEDIR := $(shell pwd) 1.4 include Rules.mk 1.5 1.6 default: $(TARGET) 1.7 + gzip -f -9 < $(TARGET) > $(TARGET).gz 1.8 1.9 install: $(TARGET) 1.10 gzip -f -9 < $(TARGET) > $(TARGET).gz
2.1 --- a/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c Mon Dec 16 11:50:19 2002 +0000 2.2 +++ b/xenolinux-2.4.16-sparse/arch/xeno/drivers/dom0/vfr.c Tue Dec 17 19:00:45 2002 +0000 2.3 @@ -56,6 +56,9 @@ static int vfr_read_proc(char *page, cha 2.4 * 2.5 */ 2.6 2.7 +#define isspace(_x) ( ((_x)==' ') || ((_x)=='\t') || ((_x)=='\v') || \ 2.8 + ((_x)=='\f') || ((_x)=='\r') || ((_x)=='\n') ) 2.9 + 2.10 static int vfr_write_proc(struct file *file, const char *buffer, 2.11 u_long count, void *data) 2.12 { 2.13 @@ -70,12 +73,12 @@ static int vfr_write_proc(struct file *f 2.14 memset(&op, 0, sizeof(network_op_t)); 2.15 2.16 // get the command: 2.17 - while ( count && (buffer[ts] == ' ') ) { ts++; count--; } // skip spaces. 2.18 + while ( count && isspace(buffer[ts]) ) { ts++; count--; } // skip spaces. 2.19 te = ts; 2.20 - while ( count && (buffer[te] != ' ') ) { te++; count--; } // command end 2.21 + while ( count && !isspace(buffer[te]) ) { te++; count--; } // command end 2.22 if ( te <= ts ) goto bad; 2.23 tl = te - ts; 2.24 - 2.25 + 2.26 if ( strncmp(&buffer[ts], "ADD", tl) == 0 ) 2.27 { 2.28 op.cmd = NETWORK_OP_ADDRULE; 2.29 @@ -119,18 +122,19 @@ static int vfr_write_proc(struct file *f 2.30 while (count) 2.31 { 2.32 //get field 2.33 - ts = te; while ( count && (buffer[ts] == ' ') ) { ts++; count--; } 2.34 + ts = te; while ( count && isspace(buffer[ts]) ) { ts++; count--; } 2.35 te = ts; 2.36 - while ( count && (buffer[te] != ' ') && (buffer[te] != '=') ) 2.37 + while ( count && !isspace(buffer[te]) && (buffer[te] != '=') ) 2.38 { te++; count--; } 2.39 - if ( te <= ts ) goto bad; 2.40 + if ( te <= ts ) 2.41 + goto doneparsing; 2.42 tl = te - ts; 2.43 fs = ts; fe = te; fl = tl; // save the field markers. 2.44 // skip " = " (ignores extra equals.) 2.45 - while ( count && ((buffer[te] == ' ') || (buffer[te] == '=')) ) 2.46 + while ( count && (isspace(buffer[te]) || (buffer[te] == '=')) ) 2.47 { te++; count--; } 2.48 ts = te; 2.49 - while ( count && (buffer[te] != ' ') ) { te++; count--; } 2.50 + while ( count && !isspace(buffer[te]) ) { te++; count--; } 2.51 tl = te - ts; 2.52 2.53 if ( (fl <= 0) || (tl <= 0) ) goto bad; 2.54 @@ -176,9 +180,9 @@ static int vfr_write_proc(struct file *f 2.55 op.u.net_rule.dst_interface = anton(&buffer[ts], tl); 2.56 } 2.57 else if ( (strncmp(&buffer[fs], "proto", fl) == 0)) 2.58 - { 2.59 - if (strncmp(&buffer[ts], "any", tl) == 0) 2.60 - op.u.net_rule.proto = NETWORK_PROTO_ANY; 2.61 + { 2.62 + if (strncmp(&buffer[ts], "any", tl) == 0) 2.63 + op.u.net_rule.proto = NETWORK_PROTO_ANY; 2.64 if (strncmp(&buffer[ts], "ip", tl) == 0) 2.65 op.u.net_rule.proto = NETWORK_PROTO_IP; 2.66 if (strncmp(&buffer[ts], "tcp", tl) == 0)