1 Index: updatedd-2.6/src/updatedd.c
2 ===================================================================
3 --- updatedd-2.6.orig/src/updatedd.c 2007-09-16 21:00:07.000000000 +0200
4 +++ updatedd-2.6/src/updatedd.c 2007-09-16 21:00:07.000000000 +0200
6 #include <limits.h> /* PATH_MAX */
9 -#define PLUGIN_ENDING ".so"
10 +#define LIBPREFIX "lib"
11 +#define LIBSUFFIX ".so"
14 print_usage(char *pname, FILE *fp)
17 get_plugin_path(char *service, char *buffer, size_t len)
20 - char la_path[PATH_MAX];
24 - (void)snprintf(la_path, PATH_MAX-1, LIBPATH "/lib%s.la", service);
26 - snprintf(command, 1023, ". %s; echo $dlname", la_path);
27 - if((pipe = popen(command, "r")) == NULL)
28 - err(PERR, "popen() failed");
29 - fscanf(pipe, "%255s", lib_name);
31 - if(fclose(pipe) == EOF)
32 - err(PERR, "fclose() failed");
34 - (void)memset(buffer, 0, len);
35 - snprintf(buffer, len-1, LIBPATH"/%s", lib_name);
36 + snprintf(buffer, len-1, LIBPATH "/" LIBPREFIX "%s" LIBSUFFIX, service);
44 +#define SERVICE_MAXLEN 20
46 get_service(DIR *dir, char *buf, size_t size)
49 struct dirent *dir_info;
51 while( (dir_info = readdir(dir)) ) {
52 + char *p = dir_info->d_name;
54 - char *ptr = strstr(dir_info->d_name, ".la");
56 - if(strlen(dir_info->d_name) < 6)
60 - if(!dir_info->d_name[0] == 'l')
62 - if(!dir_info->d_name[1] == 'i')
64 - if(!dir_info->d_name[2] == 'b')
67 - for(n = 0; dir_info->d_name+n+3 != ptr; n++) {
68 - buf[n] = dir_info->d_name[n+3];
73 + if( strlen(p) <= strlen(LIBPREFIX LIBSUFFIX) )
75 + if( strstr(p, LIBPREFIX) != p )
77 + p += strlen(LIBPREFIX);
78 + n = strlen(p) - strlen(LIBSUFFIX);
79 + if( strstr(p + n, LIBSUFFIX) != p + n )
82 + strncpy(buf, p, size);