|
|
@ -1,6 +1,7 @@
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <pwd.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <locale.h>
|
|
|
|
#include <locale.h>
|
|
|
@ -189,16 +190,21 @@ fetch_x_props(fetched_info* fi){
|
|
|
|
// Returns NULL if no such file can be found. Return value is heap-allocated.
|
|
|
|
// Returns NULL if no such file can be found. Return value is heap-allocated.
|
|
|
|
static char *
|
|
|
|
static char *
|
|
|
|
get_xdg_logo(const char *spec){
|
|
|
|
get_xdg_logo(const char *spec){
|
|
|
|
char logopath[PATH_MAX + 1]; // FIXME
|
|
|
|
const char* logopath = "/usr/share/pixmaps/";
|
|
|
|
int s = snprintf(logopath, sizeof(logopath) - 1, "%s/%s", "/usr/share/pixmaps/", spec);
|
|
|
|
int dfd = open(logopath, O_CLOEXEC | O_DIRECTORY);
|
|
|
|
if(s < 0 || (size_t)s >= sizeof(logopath)){
|
|
|
|
if(dfd < 0){
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(access(logopath, F_OK) == 0){
|
|
|
|
int r = faccessat(dfd, spec, R_OK, 0);
|
|
|
|
return strdup(logopath);
|
|
|
|
close(dfd);
|
|
|
|
}
|
|
|
|
if(r){
|
|
|
|
return NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char* p = malloc(strlen(spec) + strlen(logopath) + 1);
|
|
|
|
|
|
|
|
strcpy(p, logopath);
|
|
|
|
|
|
|
|
strcat(p, spec);
|
|
|
|
|
|
|
|
return p;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FIXME deal more forgivingly with quotation marks
|
|
|
|
// FIXME deal more forgivingly with quotation marks
|
|
|
|
static const distro_info*
|
|
|
|
static const distro_info*
|
|
|
|