Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Jul 2015 20:21:00 +0000 (UTC)
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r285857 - head/bin/ls
Message-ID:  <201507242021.t6OKL0fY008781@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: allanjude (doc committer)
Date: Fri Jul 24 20:20:59 2015
New Revision: 285857
URL: https://svnweb.freebsd.org/changeset/base/285857

Log:
  Cast uid and gid to the correct type for display to solve segfault in ls(1) on 32bit arches
  
  Correctly escape literal % for display
  
  This fixes segfaults in 32bit arches caused by r285734
  
  Reviewed by:	ngie
  Approved by:	dim
  Sponsored by:	ScaleEngine Inc.
  Differential Revision:	https://reviews.freebsd.org/D3191

Modified:
  head/bin/ls/print.c

Modified: head/bin/ls/print.c
==============================================================================
--- head/bin/ls/print.c	Fri Jul 24 19:51:51 2015	(r285856)
+++ head/bin/ls/print.c	Fri Jul 24 20:20:59 2015	(r285857)
@@ -192,7 +192,7 @@ printlong(const DISPLAY *dp)
 		if (f_numericonly) {
 			xo_emit("{t:mode/%s}{e:mode_octal/%03o} {t:links/%*u} {td:user/%-*s}{e:user/%ju}  {td:group/%-*s}{e:group/%ju}  ",
 				buf, (int) sp->st_mode & ALLPERMS, dp->s_nlink, sp->st_nlink,
-				dp->s_user, np->user, sp->st_uid, dp->s_group, np->group, sp->st_gid);
+				dp->s_user, np->user, (uintmax_t)sp->st_uid, dp->s_group, np->group, (uintmax_t)sp->st_gid);
 		} else {
 			xo_emit("{t:mode/%s}{e:mode_octal/%03o} {t:links/%*u} {t:user/%-*s}  {t:group/%-*s}  ",
 				buf, (int) sp->st_mode & ALLPERMS, dp->s_nlink, sp->st_nlink,
@@ -486,7 +486,7 @@ printtype(u_int mode)
 		xo_emit("{D:=}{e:type/socket}");
 		return (1);
 	case S_IFWHT:
-		xo_emit("{D:%}{e:type/whiteout}");
+		xo_emit("{D:%%}{e:type/whiteout}");
 		return (1);
 	default:
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507242021.t6OKL0fY008781>