Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Jul 2012 09:34:52 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238547 - head/usr.sbin/lpr/common_source
Message-ID:  <201207170934.q6H9YqWx037620@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Tue Jul 17 09:34:52 2012
New Revision: 238547
URL: http://svn.freebsd.org/changeset/base/238547

Log:
  Make sure that arraysz is initialized to a value larger than zero.
  arraysz could get initialized to zero on ZFS because ZFS reports
  directory sizes differently compared to UFS.
  
  PR:		bin/169493
  Tested by:	swills
  MFC after:	2 weeks

Modified:
  head/usr.sbin/lpr/common_source/common.c

Modified: head/usr.sbin/lpr/common_source/common.c
==============================================================================
--- head/usr.sbin/lpr/common_source/common.c	Tue Jul 17 09:31:05 2012	(r238546)
+++ head/usr.sbin/lpr/common_source/common.c	Tue Jul 17 09:34:52 2012	(r238547)
@@ -139,6 +139,8 @@ getq(const struct printer *pp, struct jo
 	 * and dividing it by a multiple of the minimum size entry.
 	 */
 	arraysz = (stbuf.st_size / 24);
+	if (arraysz < 16)
+		arraysz = 16;
 	queue = (struct jobqueue **)malloc(arraysz * sizeof(struct jobqueue *));
 	if (queue == NULL)
 		goto errdone;



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