Date: Wed, 13 Jul 2005 09:19:19 +0400 (MSD) From: Stanislav Sedov <stas@310.ru> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/83366: bsdtar executes bsdtar_warnc() before setting required data Message-ID: <200507130519.j6D5JJU6090411@dracon.310.ru> Resent-Message-ID: <200507130520.j6D5KP9J049781@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 83366 >Category: bin >Synopsis: bsdtar executes bsdtar_warnc() before setting required data >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Jul 13 05:20:24 GMT 2005 >Closed-Date: >Last-Modified: >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: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200507130519.j6D5JJU6090411>