This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi! localedef should honour --prefix option for locale archive filename (was wondering why make install-locales doesn't work and it just made /usr/lib/locale/locale-archive...). 2002-04-30 Jakub Jelinek <jakub@redhat.com> * locale/programs/locarchive.c (create_archive): Add archivefname argument, create fname from it. (enlarge_archive): Honour output_prefix. (open_archive): Likewise. --- libc/locale/programs/locarchive.c.jj Tue Apr 30 17:34:05 2002 +++ libc/locale/programs/locarchive.c Tue Apr 30 19:49:04 2002 @@ -45,8 +45,9 @@ #include "simple-hash.h" #include "localedef.h" +extern const char *output_prefix; -static const char archivefname[] = LOCALEDIR "/locale-archive"; +#define ARCHIVE_NAME LOCALEDIR "/locale-archive" static const char *locnames[] = { @@ -65,14 +66,16 @@ static const char *locnames[] = static void -create_archive (struct locarhandle *ah) +create_archive (const char *archivefname, struct locarhandle *ah) { int fd; - char fname[] = LOCALEDIR "/locale-archive.XXXXXX"; + char fname[strlen (archivefname) + sizeof (".XXXXXX")]; struct locarhead head; void *p; size_t total; + strcpy (stpcpy (fname, archivefname), ".XXXXXX"); + /* Create a temporary file in the correct directory. */ fd = mkstemp (fname); if (fd == -1) @@ -169,7 +172,6 @@ enlarge_archive (struct locarhandle *ah, { struct stat64 st; int fd; - char fname[] = LOCALEDIR "/locale-archive.XXXXXX"; struct locarhead newhead; size_t total; void *p; @@ -177,6 +179,14 @@ enlarge_archive (struct locarhandle *ah, struct namehashent *oldnamehashtab; struct locrecent *oldlocrectab; struct locarhandle new_ah; + size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; + char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; + char fname[prefix_len + sizeof (ARCHIVE_NAME) + sizeof (".XXXXXX") - 1]; + + if (output_prefix) + memcpy (archivefname, output_prefix, prefix_len); + strcpy (archivefname + prefix_len, ARCHIVE_NAME); + strcpy (stpcpy (fname, archivefname), ".XXXXXX"); /* Not all of the old file has to be mapped. Change this now this we will have to access the whole content. */ @@ -331,6 +341,12 @@ open_archive (struct locarhandle *ah) int fd; struct locarhead head; int retry = 0; + size_t prefix_len = output_prefix ? strlen (output_prefix) : 0; + char archivefname[prefix_len + sizeof (ARCHIVE_NAME)]; + + if (output_prefix) + memcpy (archivefname, output_prefix, prefix_len); + strcpy (archivefname + prefix_len, ARCHIVE_NAME); again: /* Open the archive. We must have exclusive write access. */ @@ -340,7 +356,7 @@ open_archive (struct locarhandle *ah) /* Maybe the file does not yet exist. */ if (errno == ENOENT) { - create_archive (ah); + create_archive (archivefname, ah); return; } else Jakub
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |