Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.1:kernel-2.6.32
module-init-tools
module-init-tools-config_filter.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File module-init-tools-config_filter.diff of Package module-init-tools
--- Makefile.am | 4 ++-- config_filter.c | 39 +++++++++++++++++++++++++++++++++++++++ config_filter.h | 7 +++++++ depmod.c | 4 +++- modprobe.c | 4 +++- 5 files changed, 54 insertions(+), 4 deletions(-) --- modprobe.c.orig +++ modprobe.c @@ -45,6 +45,7 @@ #include "zlibsupport.h" #include "list.h" #include "backwards_compat.c" +#include "config_filter.h" extern long init_module(void *, unsigned long, const char *); extern long delete_module(const char *, unsigned int); @@ -1199,7 +1200,8 @@ static int read_config(const char *filen if (dir) { struct dirent *i; while ((i = readdir(dir)) != NULL) { - if (!streq(i->d_name,".") && !streq(i->d_name,"..")) { + if (!streq(i->d_name,".") && !streq(i->d_name,"..") + && config_filter(i->d_name)) { char sub[strlen(filename) + 1 + strlen(i->d_name) + 1]; --- /dev/null +++ config_filter.c @@ -0,0 +1,39 @@ +#include "config_filter.h" + +#include <string.h> + +int config_filter(const char *name) +{ + const char *const *p; + + static const char *const skip_prefix[] = { + ".", + "~", + NULL + }; + + static const char *const skip_suffix[] = { + ".rpmsave", + ".rpmorig", + ".rpmnew", + ".bak", + ".YaST2save", + ".-", + "~", + NULL + }; + + for (p = skip_prefix; *p; p++) { + if (strncmp(name, *p, strlen(*p)) == 0) + return 0; + } + + for (p = skip_suffix; *p; p++) { + if (strlen(name) >= strlen(*p) && + strcmp(*p, strchr(name, 0) - strlen(*p)) == 0) + return 0; + } + + return 1; +} + --- /dev/null +++ config_filter.h @@ -0,0 +1,7 @@ +#ifndef _MODINITTOOLS_CONFIG_FILTER_H +#define _MODINITTOOLS_CONFIG_FILTER_H + +/* returns 0 if the name matches a well-known backup pattern */ +int config_filter(const char *name); + +#endif --- Makefile.am.orig +++ Makefile.am @@ -1,8 +1,8 @@ insmod_SOURCES = insmod.c testing.h lsmod_SOURCES = lsmod.c testing.h -modprobe_SOURCES = modprobe.c zlibsupport.c testing.h zlibsupport.h +modprobe_SOURCES = modprobe.c zlibsupport.c config_filter.c testing.h zlibsupport.h config_filter.h rmmod_SOURCES = rmmod.c testing.h -depmod_SOURCES = depmod.c moduleops.c tables.c zlibsupport.c depmod.h moduleops.h tables.h list.h testing.h zlibsupport.h +depmod_SOURCES = depmod.c moduleops.c tables.c zlibsupport.c config_filter.c depmod.h moduleops.h tables.h list.h testing.h zlibsupport.h config_filter.h modinfo_SOURCES = modinfo.c zlibsupport.c testing.h zlibsupport.h insmod_static_SOURCES = insmod.c --- depmod.c.orig +++ depmod.c @@ -24,6 +24,7 @@ #include "depmod.h" #include "moduleops.h" #include "tables.h" +#include "config_filter.h" #include "testing.h" @@ -1009,7 +1010,8 @@ static int read_config(const char *filen if (dir) { struct dirent *i; while ((i = readdir(dir)) != NULL) { - if (!streq(i->d_name,".") && !streq(i->d_name,"..")) { + if (!streq(i->d_name,".") && !streq(i->d_name,"..") + && config_filter(i->d_name)) { char sub[strlen(filename) + 1 + strlen(i->d_name) + 1];
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor