bin/119610: config -x appends unwanted trailing null, patched

Julian H. Stacey jhs at berklix.org
Sat Jan 12 14:40:02 PST 2008


>Number:         119610
>Category:       bin
>Synopsis:       config -x appends unwanted trailing null, patched
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 12 22:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Julian H. Stacey <jhs at berklix.com>
>Release:        FreeBSD 7.0-PRERELEASE i386
>Organization:
http://berklix.com
>Environment:
System: FreeBSD lapd.js.berklix.net 7.0-PRERELEASE FreeBSD 7.0-PRERELEASE #82: Sat Jan 12 13:14:16 CET 2008 jhs at lapd.js.berklix.net:/usr/src/sys/i386/compile/LAPD.small i386


	
>Description:
	config -x appends unwanted trailing null
	avoid it, as it upsets tools such as diff when comparing similar configs
	
>How-To-Repeat:
	config -x /boot/kernel/kernel > t
	vi t
	:$
>Fix:

	

http://berklix.com/~jhs/src/bsd/fixes/FreeBSD/src/gen/usr.sbin/config/main.c.REL=ALL.diff


*** 7.0-PRERELEASE-src-7-ctm86/src/usr.sbin/config/main.c	Sat Jan 12 23:02:26 2008
--- new/src/usr.sbin/config/main.c	Sat Jan 12 23:10:48 2008
***************
*** 687,693 ****
  	r = fseek(fp, off, SEEK_CUR);
  	if (r != 0)
  		errx(EXIT_FAILURE, "fseek() failed");
! 	while ((r = fgetc(fp)) != EOF && size-- > 0)
  		fputc(r, stdout);
  	fclose(fp);
  }
--- 687,693 ----
  	r = fseek(fp, off, SEEK_CUR);
  	if (r != 0)
  		errx(EXIT_FAILURE, "fseek() failed");
! 	while ((r = fgetc(fp)) != EOF && ( r != '\0' ) && size-- > 0)
  		fputc(r, stdout);
  	fclose(fp);
  }
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list