1e837f5f6e
harder to avoid stack overflows, bump revision for that.
44 lines
1.3 KiB
Text
44 lines
1.3 KiB
Text
$NetBSD: patch-ad,v 1.1 2006/06/26 16:11:43 joerg Exp $
|
|
|
|
--- xbmbrowser.c.orig 2006-06-26 15:30:08.000000000 +0000
|
|
+++ xbmbrowser.c
|
|
@@ -279,7 +279,11 @@ main(argc, argv)
|
|
{ extern char *getenv();
|
|
(void) strcpy(home_dir, getenv("HOME"));
|
|
if( strcmp(home_dir,"/") != 0 )
|
|
+#ifdef NAME_MAX
|
|
+ (void) strncat(home_dir, "/", NAME_MAX);
|
|
+#else
|
|
(void) strncat(home_dir, "/", MAXNAMLEN);
|
|
+#endif
|
|
}
|
|
|
|
/* Initialize other substitution strings */
|
|
@@ -314,7 +318,11 @@ main(argc, argv)
|
|
/* Initialize user menus from the appropiate RC file */
|
|
/* Do this before we chdir() into some other directory */
|
|
{ FILE *rc;
|
|
+#ifdef NAME_MAX
|
|
+ char rcfile[NAME_MAX];
|
|
+#else
|
|
char rcfile[MAXNAMLEN];
|
|
+#endif
|
|
|
|
menu_global = menu_bitmap = menu_pixmap =
|
|
menu_directory = menu_other = NULL;
|
|
@@ -358,9 +366,15 @@ main(argc, argv)
|
|
fprintf(stderr,"xbmbrowser: couldn't chdir to '%s'\n",argv[1]);
|
|
exit(-1);
|
|
}
|
|
+#ifdef NAME_MAX
|
|
+ (void) getcwd(dir_name, NAME_MAX);
|
|
+ if( strcmp(dir_name,"/") != 0 )
|
|
+ (void) strncat(dir_name, "/", NAME_MAX);
|
|
+#else
|
|
(void) getcwd(dir_name, MAXNAMLEN);
|
|
if( strcmp(dir_name,"/") != 0 )
|
|
(void) strncat(dir_name, "/", MAXNAMLEN);
|
|
+#endif
|
|
|
|
/* copy this as the initial startup directory */
|
|
strcpy(init_dir, dir_name);
|