From: Peter Howkins Date: Mon, 12 Mar 2012 15:39:22 +0000 (+0000) Subject: Linux doesn't allow open() with O_CREAT without permission flags anymore. X-Git-Tag: 2.2.0a~26^2~87 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5a09544b16212dbf55775a5759f330f363bea373;p=oweals%2Fcde.git Linux doesn't allow open() with O_CREAT without permission flags anymore. --- diff --git a/cde/programs/dtstyle/ColorFile.c b/cde/programs/dtstyle/ColorFile.c index dd768f21..bd1199c0 100644 --- a/cde/programs/dtstyle/ColorFile.c +++ b/cde/programs/dtstyle/ColorFile.c @@ -413,7 +413,11 @@ WriteOutPalette( strcat(filename, PALETTE_SUFFIX); /* open the file for writing */ +#if defined(linux) + if( (fd = open( filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR)) == -1) +#else if( (fd = open( filename, O_RDWR | O_CREAT)) == -1) +#endif { tmpStr = (char *)XtMalloc(strlen(ERR4) + strlen(filename) + 1); sprintf (tmpStr, ERR4, filename); @@ -1087,7 +1091,11 @@ CheckFileType( void ) strcat(tmpfile1, DT_PAL_DIR); strcat(tmpfile1, filename1); +#if defined(linux) + if( (fd = open( tmpfile1, O_CREAT, S_IRUSR | S_IWUSR)) == -1) +#else if( (fd = open( tmpfile1, O_CREAT)) == -1) +#endif { style. longfilename = False; XtFree(tmpfile1); @@ -1103,7 +1111,11 @@ CheckFileType( void ) strcat(tmpfile2, DT_PAL_DIR); strcat(tmpfile2, filename2); +#if defined(linux) + if( (fd1 = open(tmpfile2, O_CREAT | O_EXCL, S_IRUSR | S_IWUSR)) == -1) +#else if( (fd1 = open(tmpfile2, O_CREAT | O_EXCL)) == -1) +#endif { style.longfilename = False; }