Fixes: krw@tcn.net
This commit is contained in:
parent
592a00a401
commit
8093cbde3f
@ -1,6 +1,16 @@
|
|||||||
--- configure.orig Thu Dec 3 15:49:24 1998
|
--- configure.orig Fri Nov 27 06:24:31 1998
|
||||||
+++ configure Thu Dec 3 15:49:53 1998
|
+++ configure Sun Dec 20 10:36:34 1998
|
||||||
@@ -3751,7 +3751,7 @@
|
@@ -1912,7 +1912,8 @@
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||||
|
- for ac_dir in /lib:/usr/bin:/bin:/usr/lib:/usr/ccs/lib:$PATH$ac_dummy; do
|
||||||
|
+ # Remove apparent bash'ism: OpenBSD /bin/sh does NOT parse literals with IFS
|
||||||
|
+ for ac_dir in /lib /usr/bin /bin /usr/lib /usr/ccs/lib $PATH$ac_dummy; do
|
||||||
|
test -z "$ac_dir" && ac_dir=.
|
||||||
|
if test -f $ac_dir/$ac_word; then
|
||||||
|
ac_cv_path_CPP_PATH="$ac_dir/$ac_word"
|
||||||
|
@@ -3751,7 +3752,7 @@
|
||||||
if test "$my_libok" = yes; then
|
if test "$my_libok" = yes; then
|
||||||
my_old_cppflags=$CPPFLAGS
|
my_old_cppflags=$CPPFLAGS
|
||||||
CPPFLAGS="$CPPFLAGS $GFX_INC_PATH $XCFLAGS"
|
CPPFLAGS="$CPPFLAGS $GFX_INC_PATH $XCFLAGS"
|
||||||
@ -9,7 +19,7 @@
|
|||||||
echo $ac_n "checking for gif_lib.h""... $ac_c" 1>&6
|
echo $ac_n "checking for gif_lib.h""... $ac_c" 1>&6
|
||||||
echo "configure:3757: checking for gif_lib.h" >&5
|
echo "configure:3757: checking for gif_lib.h" >&5
|
||||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||||
@@ -3760,7 +3760,7 @@
|
@@ -3760,7 +3761,7 @@
|
||||||
cat > conftest.$ac_ext <<EOF
|
cat > conftest.$ac_ext <<EOF
|
||||||
#line 3762 "configure"
|
#line 3762 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
@ -18,3 +28,4 @@
|
|||||||
EOF
|
EOF
|
||||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||||
{ (eval echo configure:3767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
{ (eval echo configure:3767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||||
|
|
||||||
|
@ -1,64 +1,41 @@
|
|||||||
--- libPropList/filehandling.c.orig Fri Dec 18 01:58:03 1998
|
--- libPropList/filehandling.c.orig Sat Oct 17 15:58:37 1998
|
||||||
+++ libPropList/filehandling.c Fri Dec 18 01:58:16 1998
|
+++ libPropList/filehandling.c Sat Dec 19 23:04:09 1998
|
||||||
@@ -16,6 +16,7 @@
|
@@ -16,6 +16,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
+#include <dirent.h>
|
+#include <limits.h>
|
||||||
|
|
||||||
#define pl_scan_string(c) yy_scan_string(c)
|
#define pl_scan_string(c) yy_scan_string(c)
|
||||||
#define plparse() yyparse()
|
#define plparse() yyparse()
|
||||||
@@ -350,45 +351,80 @@
|
@@ -345,58 +346,30 @@
|
||||||
char tmp_fileName[255];
|
|
||||||
char tmp_realFileName[255];
|
BOOL PLSave(proplist_t pl, BOOL atomically)
|
||||||
char dirname[255];
|
{
|
||||||
+ char dirbase[50]={"/tmp"};
|
- const char *theFileName;
|
||||||
+ char mkstmpname[20]={"/tmp/wmaker.XXXXXX"};
|
+ char theFileName[ PATH_MAX+1 ] = "\0";
|
||||||
char *tmp_dirname, *tmp2_dirname;
|
+ const char *tempmask = ".XXXXXXXXXX";
|
||||||
char *basename, *tmp_basename;
|
const char *theRealFileName = NULL;
|
||||||
FILE *theFile;
|
- char tmp_fileName[255];
|
||||||
|
- char tmp_realFileName[255];
|
||||||
|
- char dirname[255];
|
||||||
|
- char *tmp_dirname, *tmp2_dirname;
|
||||||
|
- char *basename, *tmp_basename;
|
||||||
|
- FILE *theFile;
|
||||||
|
+ FILE *theFile = NULL;
|
||||||
int c;
|
int c;
|
||||||
char *desc = NULL;
|
char *desc = NULL;
|
||||||
-
|
|
||||||
+ int i,temp_safe;
|
|
||||||
+ DIR *diro;
|
|
||||||
+ struct dirent *dire;
|
|
||||||
+ struct stat safe_stat;
|
|
||||||
+
|
|
||||||
theRealFileName = PLGetString(PLGetFilename(pl));
|
theRealFileName = PLGetString(PLGetFilename(pl));
|
||||||
|
+
|
||||||
if(!theRealFileName) return NO;
|
if(!theRealFileName) return NO;
|
||||||
|
|
||||||
|
+ /* Open the file (whether temp or real) for writing. */
|
||||||
if (atomically)
|
if (atomically)
|
||||||
{
|
{
|
||||||
- theFileName = tmpnam(NULL);
|
- theFileName = tmpnam(NULL);
|
||||||
- strcpy(tmp_fileName, theFileName);
|
- strcpy(tmp_fileName, theFileName);
|
||||||
+#ifdef HAVE_MKSTEMP /* THIS IS THE MKSTEMP STUFF. FOR OPENBSD, ETC. */
|
-
|
||||||
+ /* im an idiot. this made wmaker crash. */
|
|
||||||
+ temp_safe = mkstemp(mkstmpname);
|
|
||||||
+ if((fstat(temp_safe,&safe_stat))!=0)
|
|
||||||
+ goto failure;
|
|
||||||
+ desc=PLGetDescriptionIndent(pl,0);
|
|
||||||
+ theFile=fdopen(temp_safe,"r+");
|
|
||||||
+ c=fwrite(desc,sizeof(char),strlen(desc),theFile);
|
|
||||||
+ if(c<strlen(desc))
|
|
||||||
+ goto failure;
|
|
||||||
+ fwrite("\n",sizeof(char),strlen("\n"),theFile);
|
|
||||||
+ diro=opendir(dirbase);
|
|
||||||
+ dire=readdir(diro);
|
|
||||||
+ while(safe_stat.st_ino!=dire->d_ino)
|
|
||||||
+ dire=readdir(diro);
|
|
||||||
+ fclose(theFile);
|
|
||||||
+ strncpy(tmp_fileName,dirbase,4);
|
|
||||||
+ tmp_fileName[5]='\0';
|
|
||||||
+ strncat(tmp_fileName,"/",1);
|
|
||||||
+ strncat(tmp_fileName,dire->d_name,15); /* should normally be under 15 */
|
|
||||||
+ c=rename(tmp_fileName,theRealFileName);
|
|
||||||
+ closedir(diro);
|
|
||||||
+ if(c!=0)
|
|
||||||
+ goto failure;
|
|
||||||
+ else
|
|
||||||
+ goto success;
|
|
||||||
|
|
||||||
- if((tmp_basename=strtok(tmp_fileName, "/")))
|
- if((tmp_basename=strtok(tmp_fileName, "/")))
|
||||||
- do
|
- do
|
||||||
- basename=tmp_basename;
|
- basename=tmp_basename;
|
||||||
@ -84,48 +61,21 @@
|
|||||||
- }
|
- }
|
||||||
-
|
-
|
||||||
- theFileName = strcat(dirname, basename);
|
- theFileName = strcat(dirname, basename);
|
||||||
+#else /* the old code for the tmp file */
|
+ if (strlen( theRealFileName )+strlen( tempmask ) > PATH_MAX)
|
||||||
+
|
+ goto failure; /* path too long to create temporary file */
|
||||||
+ theFileName = tmpnam(NULL);
|
+ strncpy( theFileName, theRealFileName, PATH_MAX );
|
||||||
+ strcpy(tmp_fileName, theFileName);
|
+ strncpy( theFileName, tempmask, PATH_MAX - strlen( theRealFileName ) );
|
||||||
+
|
+ theFile = fdopen( mkstemp( theFileName ), "w" );
|
||||||
+ if((tmp_basename=strtok(tmp_fileName, "/")))
|
|
||||||
+ do
|
|
||||||
+ basename=tmp_basename;
|
|
||||||
+ while((tmp_basename=strtok(NULL, "/")));
|
|
||||||
+ else
|
|
||||||
+ basename=(char *)theFileName;
|
|
||||||
+
|
|
||||||
+ strcpy(tmp_realFileName, theRealFileName);
|
|
||||||
+ dirname[0]='\0';
|
|
||||||
+
|
|
||||||
+ if((tmp_dirname=strtok(tmp_realFileName, "/")))
|
|
||||||
+ {
|
|
||||||
+ if(theRealFileName[0]=='/')
|
|
||||||
+ strcat(dirname, "/");
|
|
||||||
+ tmp2_dirname = strtok(NULL, "/");
|
|
||||||
+ while((tmp2_dirname))
|
|
||||||
+ {
|
|
||||||
+ strcat(dirname, tmp_dirname);
|
|
||||||
+ strcat(dirname, "/");
|
|
||||||
+ tmp_dirname = tmp2_dirname;
|
|
||||||
+ tmp2_dirname = strtok(NULL, "/");
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ theFileName = strcat(dirname, basename);
|
|
||||||
+#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -436,9 +472,10 @@
|
- theFileName = theRealFileName;
|
||||||
goto failure;
|
+ theFile = fopen( theRealFileName, "w" );
|
||||||
}
|
}
|
||||||
|
-
|
||||||
|
- /* Open the file (whether temp or real) for writing. */
|
||||||
|
- theFile = fopen(theFileName, "w");
|
||||||
|
|
||||||
- /* success: */
|
if (theFile == NULL) /* Something went wrong; we weren't
|
||||||
+ success:
|
* even able to open the file. */
|
||||||
MyFree(__FILE__, __LINE__, desc);
|
|
||||||
return YES;
|
|
||||||
+
|
|
||||||
|
|
||||||
/* Just in case the failure action needs to be changed. */
|
|
||||||
failure:
|
|
||||||
|
Loading…
Reference in New Issue
Block a user