bin/83366: bsdtar executes bsdtar_warnc() before setting required
data
Stanislav Sedov
stas at 310.ru
Wed Jul 13 05:20:26 GMT 2005
>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 at 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:
More information about the freebsd-bugs
mailing list