- Don't attempt to open directories as source files (#141634, original
patch by Paul Nasrat)
This commit is contained in:
parent
7feb970589
commit
273a567390
56
kbd-1.12-dir.patch
Normal file
56
kbd-1.12-dir.patch
Normal file
@ -0,0 +1,56 @@
|
||||
--- kbd-1.12/src/findfile.c.dir 2004-01-16 20:45:31.000000000 +0100
|
||||
+++ kbd-1.12/src/findfile.c 2005-05-20 15:36:45.000000000 +0200
|
||||
@@ -92,6 +92,7 @@
|
||||
if (d == NULL)
|
||||
return NULL;
|
||||
while ((de = readdir(d)) != NULL) {
|
||||
+ struct stat statbuf;
|
||||
int okdir;
|
||||
|
||||
if (strcmp(de->d_name, ".") == 0 ||
|
||||
@@ -104,7 +105,6 @@
|
||||
okdir = (ff && strcmp(de->d_name, fdir) == 0);
|
||||
|
||||
if ((secondpass && recdepth) || okdir) {
|
||||
- struct stat statbuf;
|
||||
char *a;
|
||||
|
||||
a = xmalloc(strlen(dir) + strlen(de->d_name) + 2);
|
||||
@@ -136,6 +136,8 @@
|
||||
continue;
|
||||
|
||||
sprintf(pathname, "%s/%s", dir, de->d_name);
|
||||
+ if (stat(pathname, &statbuf) != 0 || !S_ISREG(statbuf.st_mode))
|
||||
+ continue;
|
||||
|
||||
/* Does tail consist of a known suffix and possibly
|
||||
a compression suffix? */
|
||||
@@ -180,13 +182,16 @@
|
||||
/* Test for full pathname - opening it failed, so need suffix */
|
||||
/* (This is just nonsense, for backwards compatibility.) */
|
||||
if (*fnam == '/') {
|
||||
+ struct stat statbuf;
|
||||
+
|
||||
for (sp = suffixes; *sp; sp++) {
|
||||
if (strlen(fnam) + strlen(*sp) + 1 > sizeof(pathname))
|
||||
continue;
|
||||
if (*sp == 0)
|
||||
continue; /* we tried it already */
|
||||
sprintf(pathname, "%s%s", fnam, *sp);
|
||||
- if((fp = fopen(pathname, "r")) != NULL)
|
||||
+ if(stat(pathname, &statbuf) == 0 && S_ISREG(statbuf.st_mode)
|
||||
+ && (fp = fopen(pathname, "r")) != NULL)
|
||||
return fp;
|
||||
}
|
||||
|
||||
@@ -196,7 +201,9 @@
|
||||
+ strlen(dc->ext) + 1 > sizeof(pathname))
|
||||
continue;
|
||||
sprintf(pathname, "%s%s%s", fnam, *sp, dc->ext);
|
||||
- if ((fp = fopen(pathname, "r")) != NULL) {
|
||||
+ if (stat(pathname, &statbuf) == 0
|
||||
+ && S_ISREG(statbuf.st_mode)
|
||||
+ && (fp = fopen(pathname, "r")) != NULL) {
|
||||
fclose(fp);
|
||||
return pipe_open(dc);
|
||||
}
|
8
kbd.spec
8
kbd.spec
@ -1,7 +1,7 @@
|
||||
Summary: Tools for configuring the console (keyboard, virtual terminals, etc.)
|
||||
Name: kbd
|
||||
Version: 1.12
|
||||
Release: 9
|
||||
Release: 10
|
||||
License: GPL
|
||||
Group: System Environment/Base
|
||||
Source0: ftp://ftp.kernel.org/pub/linux/utils/kbd/kbd-%{version}.tar.bz2
|
||||
@ -20,6 +20,7 @@ Patch4: kbd-1.12-setfont-man.patch
|
||||
Patch5: kbd-1.12-Meta_utf8.patch
|
||||
Patch6: kbd-1.12-nostrip.patch
|
||||
Patch7: kbd-1.12-alias.patch
|
||||
Patch8: kbd-1.12-dir.patch
|
||||
Obsoletes: console-tools
|
||||
Provides: console-tools
|
||||
Conflicts: util-linux < 2.11r-9
|
||||
@ -42,6 +43,7 @@ fonts, the virtual terminals and font files.
|
||||
%patch5 -p1 -b .Meta_utf8
|
||||
%patch6 -p1 -b .nostrip
|
||||
%patch7 -p1 -b .alias
|
||||
%patch8 -p1 -b .dir
|
||||
|
||||
# 7-bit maps are obsolete; so are non-euro maps
|
||||
pushd data/keymaps/i386
|
||||
@ -120,6 +122,10 @@ install -c -m644 $RPM_SOURCE_DIR/kbdrate.pam \
|
||||
%config %{_sysconfdir}/pam.d/*
|
||||
|
||||
%changelog
|
||||
* Fri May 20 2005 Miloslav Trmac <mitr@redhat.com> - 1.12-10
|
||||
- Don't attempt to open directories as source files (#141634, original patch by
|
||||
Paul Nasrat)
|
||||
|
||||
* Tue May 17 2005 Miloslav Trmac <mitr@redhat.com> - 1.12-9
|
||||
- Fix another violation of C aliasing rules (#157720, patch by Jan Kratochvil)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user