Skip to content

Commit c2b26aa

Browse files
committed
dtar: set the locale for character handling
This ensures that UTF-8 file names are handled correctly by libarchive.
1 parent 03b1122 commit c2b26aa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/dtar/dtar.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <mpi.h>
1717
#include <string.h>
1818
#include <getopt.h>
19+
#include <locale.h>
1920

2021
#include "mfu.h"
2122

@@ -161,6 +162,10 @@ static void print_usage(void)
161162

162163
int main(int argc, char** argv)
163164
{
165+
/* Set the locale for character handling to the user's environment settings
166+
* to ensure that file names are handled correctly by libarchive */
167+
setlocale(LC_CTYPE, "");
168+
164169
MPI_Init(&argc, &argv);
165170
mfu_init();
166171

0 commit comments

Comments
 (0)