Hurd compat fixes. Mostly dealing with absent PATH_MAX
Signed-off-by: Jérémie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
committed by
Denys Vlasenko
parent
35fdb1bc9c
commit
fbedacfc8c
@ -79,7 +79,9 @@ void exec_kernel_doc(char **svec)
|
||||
{
|
||||
pid_t pid;
|
||||
int ret;
|
||||
char real_filename[PATH_MAX + 1];
|
||||
char *real_filename;
|
||||
int rflen;
|
||||
|
||||
/* Make sure output generated so far are flushed */
|
||||
fflush(stdout);
|
||||
switch(pid=fork()) {
|
||||
@ -87,10 +89,11 @@ void exec_kernel_doc(char **svec)
|
||||
perror("fork");
|
||||
exit(1);
|
||||
case 0:
|
||||
memset(real_filename, 0, sizeof(real_filename));
|
||||
strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
|
||||
strncat(real_filename, KERNELDOCPATH KERNELDOC,
|
||||
PATH_MAX - strlen(real_filename));
|
||||
rflen = strlen(getenv("SRCTREE"));
|
||||
rflen += strlen(KERNELDOCPATH KERNELDOC);
|
||||
real_filename = alloca(rflen + 1);
|
||||
strcpy(real_filename, getenv("SRCTREE"));
|
||||
strcat(real_filename, KERNELDOCPATH KERNELDOC);
|
||||
execvp(real_filename, svec);
|
||||
fprintf(stderr, "exec ");
|
||||
perror(real_filename);
|
||||
@ -166,11 +169,10 @@ void find_export_symbols(char * filename)
|
||||
struct symfile *sym;
|
||||
char line[MAXLINESZ];
|
||||
if (filename_exist(filename) == NULL) {
|
||||
char real_filename[PATH_MAX + 1];
|
||||
memset(real_filename, 0, sizeof(real_filename));
|
||||
strncat(real_filename, getenv("SRCTREE"), PATH_MAX);
|
||||
strncat(real_filename, filename,
|
||||
PATH_MAX - strlen(real_filename));
|
||||
int rflen = strlen(getenv("SRCTREE")) + strlen(filename);
|
||||
char *real_filename = alloca(rflen + 1);
|
||||
strcpy(real_filename, getenv("SRCTREE"));
|
||||
strcat(real_filename, filename);
|
||||
sym = add_new_file(filename);
|
||||
fp = fopen(real_filename, "r");
|
||||
if (fp == NULL)
|
||||
|
@ -203,7 +203,7 @@ void clear_config(void)
|
||||
*/
|
||||
void use_config(char *m, int slen)
|
||||
{
|
||||
char s[PATH_MAX];
|
||||
char *s = alloca(slen+1);
|
||||
char *p;
|
||||
|
||||
if (is_defined_config(m, slen))
|
||||
@ -310,7 +310,7 @@ void parse_dep_file(void *map, size_t len)
|
||||
char *m = map;
|
||||
char *end = m + len;
|
||||
char *p;
|
||||
char s[PATH_MAX];
|
||||
char *s = alloca(len);
|
||||
|
||||
p = memchr(m, ':', len);
|
||||
if (!p) {
|
||||
|
@ -70,12 +70,13 @@ static char *conf_expand_value(const char *in)
|
||||
char *conf_get_default_confname(void)
|
||||
{
|
||||
struct stat buf;
|
||||
static char fullname[PATH_MAX+1];
|
||||
static char *fullname = NULL;
|
||||
char *env, *name;
|
||||
|
||||
name = conf_expand_value(conf_defname);
|
||||
env = getenv(SRCTREE);
|
||||
if (env) {
|
||||
fullname = realloc(fullname, strlen(env) + strlen(name) + 2);
|
||||
sprintf(fullname, "%s/%s", env, name);
|
||||
if (!stat(fullname, &buf))
|
||||
return fullname;
|
||||
|
@ -258,7 +258,7 @@ search_help[] = N_(
|
||||
|
||||
static char buf[4096], *bufptr = buf;
|
||||
static char input_buf[4096];
|
||||
static char filename[PATH_MAX+1] = ".config";
|
||||
static const char filename[] = ".config";
|
||||
static char *args[1024], **argptr = args;
|
||||
static int indent;
|
||||
static struct termios ios_org;
|
||||
|
@ -265,13 +265,14 @@ static void zconf_endhelp(void)
|
||||
*/
|
||||
FILE *zconf_fopen(const char *name)
|
||||
{
|
||||
char *env, fullname[PATH_MAX+1];
|
||||
char *env;
|
||||
FILE *f;
|
||||
|
||||
f = fopen(name, "r");
|
||||
if (!f && name[0] != '/') {
|
||||
env = getenv(SRCTREE);
|
||||
if (env) {
|
||||
char *fullname = alloca(strlen(env) + strlen(name) + 2);
|
||||
sprintf(fullname, "%s/%s", env, name);
|
||||
f = fopen(fullname, "r");
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
#define LKC_DIRECT_LINK
|
||||
#include "lkc.h"
|
||||
|
||||
#include "zconf.hash.c"
|
||||
|
||||
#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
|
||||
|
||||
#define PRINTD 0x0001
|
||||
@ -99,6 +97,10 @@ static struct menu *current_menu, *current_entry;
|
||||
menu_end_menu();
|
||||
} if_entry menu_entry choice_entry
|
||||
|
||||
%{
|
||||
#include "zconf.hash.c"
|
||||
%}
|
||||
|
||||
%%
|
||||
input: stmt_list;
|
||||
|
||||
|
Reference in New Issue
Block a user