[klibc] [PATCH] fix root on nfs

Olaf Hering olh at suse.de
Sat Aug 14 17:23:28 PDT 2004


 On Mon, May 24, Olaf Hering wrote:

> 
> this patch fixes root on nfs for me.

Is there a reason why you did not apply this one?

> The struct is not initialized correctly, the option for bind is wrong.
> And the pad_len algorithm looks a bit odd:
> 
> int main(void)
> {
>         int i;
>         for (i = 0; i < 42; i++) {
>                 printf("%d %d %d\n", i, (i + 3) & ~3,
>                        (i % 8) ? (i & 7) + 8 : i);
>         }
>         return 0;
> }
> 
> 1 4 9
> 2 4 10
> 3 4 11
> 4 4 12
> 5 8 13
> 6 8 14
> 7 8 15
> 8 8 8
> 9 12 9
> 10 12 10
> 11 12 11
> 12 12 12
> 13 16 13
> 14 16 14
> 15 16 15
> 16 16 16
> 17 20 9
> 18 20 10
> 19 20 11
> 20 20 12
> 21 24 13
> 22 24 14
> 23 24 15
> 24 24 24
> 25 28 9
> 26 28 10
> 
> 
> diff -p -ppurN klibc-0.116/klibc/inet/bindresvport.c klibc-0.116.nfsmount/klibc/inet/bindresvport.c
> --- klibc-0.116/klibc/inet/bindresvport.c	2003-12-08 02:33:24.000000000 +0100
> +++ klibc-0.116.nfsmount/klibc/inet/bindresvport.c	2004-05-24 20:01:50.000000000 +0200
> @@ -23,7 +23,7 @@ int bindresvport(int sd, struct sockaddr
>  	if (sin == NULL) {
>  		sin = &me;
>  		memset(sin, 0, sizeof(me));
> -		sin->sin_port = AF_INET;
> +		sin->sin_family = AF_INET;
>  	}
>  	else if (sin->sin_family != AF_INET) {
>  		errno = EPFNOSUPPORT;
> @@ -37,7 +37,7 @@ int bindresvport(int sd, struct sockaddr
>  	
>  	for (i = 0; i < NUM_PORTS; i++, port++) {
>  		sin->sin_port = htons(port);
> -		if ((ret = bind(sd, (struct sockaddr *)&sin, sizeof(*sin))) != -1)
> +		if ((ret = bind(sd, (struct sockaddr *)sin, sizeof(*sin))) != -1)
>  			break;
>  		if (port == END_PORT)
>  			port = START_PORT;
> diff -p -ppurN klibc-0.116/nfsmount/mount.c klibc-0.116.nfsmount/nfsmount/mount.c
> --- klibc-0.116/nfsmount/mount.c	2003-05-06 00:15:09.000000000 +0200
> +++ klibc-0.116.nfsmount/nfsmount/mount.c	2004-05-24 18:52:35.000000000 +0200
> @@ -77,9 +77,7 @@ static void get_ports(__u32 server, cons
>  
>  static inline int pad_len(int len)
>  {
> -	if (len % 8)
> -		return (len & 7) + 8;
> -	return len;
> +	return (len + 3) & ~3;
>  }
>  
>  static inline void dump_params(__u32 server,
> 
> 
> -- 
> USB is for mice, FireWire is for men!
> 
> sUse lINUX ag, nÜRNBERG
> 
> _______________________________________________
> klibc mailing list
> klibc at zytor.com
> http://www.zytor.com/mailman/listinfo/klibc
> 

-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG



More information about the klibc mailing list