From stas@dracon.310.ru  Wed Jul 13 05:19:28 2005
Return-Path: <stas@dracon.310.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0491416A41C
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Jul 2005 05:19:28 +0000 (GMT)
	(envelope-from stas@dracon.310.ru)
Received: from dracon.310.ru (dracon.310.ru [83.97.105.66])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 65D4543D46
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Jul 2005 05:19:27 +0000 (GMT)
	(envelope-from stas@dracon.310.ru)
Received: from dracon.310.ru (localhost.310.ru [127.0.0.1])
	by dracon.310.ru (8.13.3/8.13.1) with ESMTP id j6D5JPHs090412
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 13 Jul 2005 09:19:25 +0400 (MSD)
	(envelope-from stas@dracon.310.ru)
Received: (from stas@localhost)
	by dracon.310.ru (8.13.3/8.13.1/Submit) id j6D5JJU6090411;
	Wed, 13 Jul 2005 09:19:19 +0400 (MSD)
	(envelope-from stas)
Message-Id: <200507130519.j6D5JJU6090411@dracon.310.ru>
Date: Wed, 13 Jul 2005 09:19:19 +0400 (MSD)
From: Stanislav Sedov <stas@310.ru>
Reply-To: Stanislav Sedov <stas@310.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: bsdtar executes bsdtar_warnc() before setting required data
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         83366
>Category:       bin
>Synopsis:       bsdtar executes bsdtar_warnc() before setting required data
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kientzle
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 13 05:20:24 GMT 2005
>Closed-Date:    Tue Aug 02 03:03:30 GMT 2005
>Last-Modified:  Tue Aug 02 03:03:30 GMT 2005
>Originator:     Stanislav Sedov
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
310.ru [Tridesyatoe]
>Environment:
System: FreeBSD stalingrad.realnet 6.0-CURRENT FreeBSD 6.0-CURRENT #4: Mon Jul 11 10:56:37 MSD 2005 root@stalingrad.realnet:/work/src/fbsd-cur/src/sys/i386/compile/DESKTOP i386


	
>Description:
	bsdtar calls setlocale(3) before setting the bsdtar->progname
 variable, so if this operation fails, the function called, bsdtar_warnc,
 cannot print error message properly, as it uses this variable.
>How-To-Repeat:
	Force setlocale(3) error.
>Fix:

	

--- bsdtar.c.diff begins here ---
--- bsdtar.c.orig	Sat Jul  9 07:27:26 2005
+++ bsdtar.c	Sat Jul  9 07:28:35 2005
@@ -206,11 +206,6 @@
 	bsdtar->fd = -1; /* Mark as "unused" */
 	option_o = 0;
 
-	if (setlocale(LC_ALL, "") == NULL)
-		bsdtar_warnc(bsdtar, 0, "Failed to set default locale");
-#if defined(HAVE_NL_LANGINFO) && defined(HAVE_D_MD_ORDER)
-	bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd');
-#endif
 	possible_help_request = 0;
 
 	/* Look up uid of current user for future reference */
@@ -236,6 +231,12 @@
 		else
 			bsdtar->progname = *argv;
 	}
+
+	if (setlocale(LC_ALL, "") == NULL)
+		bsdtar_warnc(bsdtar, 0, "Failed to set default locale");
+#if defined(HAVE_NL_LANGINFO) && defined(HAVE_D_MD_ORDER)
+	bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+#endif
 
 	/* Rewrite traditional-style tar arguments, if used. */
 	argv = rewrite_argv(bsdtar, &argc, argv, tar_opts);
--- bsdtar.c.diff ends here ---
--- report-bsdtar.c ends here ---


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kientzle 
Responsible-Changed-By: pjd 
Responsible-Changed-When: Sun Jul 17 12:51:26 GMT 2005 
Responsible-Changed-Why:  
Over to bsdtar(1) maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=83366 
State-Changed-From-To: open->closed 
State-Changed-By: kientzle 
State-Changed-When: Tue Aug 2 03:01:42 GMT 2005 
State-Changed-Why:  
Fixed in bsdtar.c 1.64. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=83366 
>Unformatted:
