setfont: small fixes from Vladimir

This commit is contained in:
Denis Vlasenko 2008-09-18 01:01:02 +00:00
parent 2228426512
commit 72fa70af4c

View File

@ -233,16 +233,16 @@ int setfont_main(int argc UNUSED_PARAM, char **argv)
fd = xopen(tty_name, O_NONBLOCK); fd = xopen(tty_name, O_NONBLOCK);
if (sizeof(CONFIG_DEFAULT_SETFONT_DIR) > 1) { // if not "" if (sizeof(CONFIG_DEFAULT_SETFONT_DIR) > 1) { // if not ""
if (strchr(*argv, '/') != NULL) { if (*argv[0] != '/') {
// goto default fonts location. don't die if doesn't exist // goto default fonts location. don't die if doesn't exist
chdir(CONFIG_DEFAULT_SETFONT_DIR "/consolefonts"); chdir(CONFIG_DEFAULT_SETFONT_DIR "/consolefonts");
// buglet: we don't return to current dir...
// affects "setfont FONT -m ./MAP" case
} }
} }
// load font // load font
len = 32*1024; // can't be larger len = 32*1024; // can't be larger
psfhdr = (struct psf_header *) xmalloc_open_zipped_read_close(*argv, &len); psfhdr = (struct psf_header *) xmalloc_open_zipped_read_close(*argv, &len);
if (!psfhdr)
bb_simple_perror_msg_and_die(*argv);
do_load(fd, psfhdr, len); do_load(fd, psfhdr, len);
// load the screen map, if any // load the screen map, if any
@ -251,7 +251,7 @@ int setfont_main(int argc UNUSED_PARAM, char **argv)
void *map; void *map;
if (sizeof(CONFIG_DEFAULT_SETFONT_DIR) > 1) { // if not "" if (sizeof(CONFIG_DEFAULT_SETFONT_DIR) > 1) { // if not ""
if (strchr(mapfilename, '/') != NULL) { if (mapfilename[0] != '/') {
// goto default keymaps location // goto default keymaps location
chdir(CONFIG_DEFAULT_SETFONT_DIR "/consoletrans"); chdir(CONFIG_DEFAULT_SETFONT_DIR "/consoletrans");
} }