FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo Development

 
 
LinkBack Thread Tools
 
Old 03-04-2011, 12:47 PM
Ales Kozumplik
 
Default Another fix for the loader translations.

Fixes a sigsegv in loadLanguage(). While at it make sure /tmp/translations
is really removed (frees some 700kB of the ramdisk).

Resolves: rhbz#682213
---
loader/lang.c | 25 +++++++++----------------
loader/loadermisc.c | 2 +-
2 files changed, 10 insertions(+), 17 deletions(-)

diff --git a/loader/lang.c b/loader/lang.c
index 94e33e0..7ee7b9c 100644
--- a/loader/lang.c
+++ b/loader/lang.c
@@ -140,7 +140,8 @@ int getLangInfo(struct langInfo ** langs) {
return numLanguages;
}

-void loadLanguage (char * file) {
+void loadLanguage(void)
+{
char *filename;
int fd, hash, rc;
char * key = getenv("LANGKEY");
@@ -149,31 +150,20 @@ void loadLanguage (char * file) {
free(strings), strings = NULL;
numStrings = allocedStrings = 0;
}
-
+
/* english requires no files */
if (!strcmp(key, "en"))
return;

- if (!file) {
- file = filename;
- sprintf(filename, "/etc/loader.tr");
- }
-
- if (access(file, R_OK) == -1) {
- newtWinMessage("Error", "OK", "Translation for %s is not available. "
- "The Installation will proceed in English.", key);
- return ;
- }
+ checked_asprintf(&filename, "/tmp/translation/%s.tr", key);

rc = unpack_archive_file("/etc/loader.tr", "/tmp/translation");
-
if (rc != ARCHIVE_OK || access("/tmp/translation", R_OK) == -1) {
newtWinMessage("Error", "OK", "Cannot get translation file %s.
",
filename);
return;
}

- checked_asprintf(&filename, "/tmp/translation/%s.tr", key);
fd = open(filename, O_RDONLY);
if (fd < 0) {
newtWinMessage("Error", "OK", "Failed to open /tmp/translation: %m
");
@@ -198,7 +188,10 @@ void loadLanguage (char * file) {

close(fd);
free(filename);
- unlink("/tmp/translation");
+ int translation_dir_fd = open("/tmp/translation", O_RDONLY);
+ recursiveRemove(translation_dir_fd);
+ close(translation_dir_fd);
+ rmdir("/tmp/translation");

qsort(strings, numStrings, sizeof(*strings), aStringCmp);
}
@@ -220,7 +213,7 @@ static void setLangEnv (int i) {
setenv("LANG", languages[i].lc_all, 1);
setenv("LANGKEY", languages[i].key, 1);
setenv("LINGUAS", languages[i].lang, 1);
- loadLanguage (NULL);
+ loadLanguage();
}

/* choice is the index of the chosen language in languages */
diff --git a/loader/loadermisc.c b/loader/loadermisc.c
index d0ff3d4..61e77bf 100644
--- a/loader/loadermisc.c
+++ b/loader/loadermisc.c
@@ -93,7 +93,7 @@ int copyFile(char * source, char * dest) {
* Do "rm -rf" on the target directory.
*
* Returns 0 on success, nonzero otherwise (i.e. directory doesn't exist or
- * some of its contents couldn't be removed.
+ * some of its contents couldn't be removed).
*
* This is copied from the util-linux-ng project.
*/
--
1.7.3.3

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-04-2011, 01:47 PM
Chris Lumens
 
Default Another fix for the loader translations.

> Fixes a sigsegv in loadLanguage(). While at it make sure /tmp/translations
> is really removed (frees some 700kB of the ramdisk).

Looks good to me.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 09:32 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org