replace fchmod() with chmod()
Steven Edwards
winehacker at gmail.com
Thu Aug 24 00:19:54 CDT 2006
Detlef sent this in a while back and I think it slipped through the que.
Changelog:
Detlef Riekenberg wine.dev at web.de
- tools/winedump: replace fchmod() with chmod()
--
Steven Edwards
"There is one thing stronger than all the armies in the world, and
that is an idea whose time has come." - Victor Hugo
-------------- next part --------------
diff --git a/tools/winedump/misc.c b/tools/winedump/misc.c
index 82e0bd8..9a10e4f 100644
--- a/tools/winedump/misc.c
+++ b/tools/winedump/misc.c
@@ -196,17 +196,16 @@ char *str_toupper (char *str)
*/
FILE *open_file (const char *name, const char *ext, const char *mode)
{
- char fname[128];
FILE *fp;
- if (((unsigned)snprintf (fname, sizeof (fname), "%s%s%s",
- *mode == 'w' ? "./" : "", name, ext) > sizeof (fname)))
+ if (((unsigned)snprintf (globals.fname, sizeof (globals.fname), "%s%s%s",
+ *mode == 'w' ? "./" : "", name, ext) > sizeof (globals.fname)))
fatal ("File name too long");
if (VERBOSE)
- printf ("Open file %s\n", fname);
+ printf ("Open file %s\n", globals.fname);
- fp = fopen (fname, mode);
+ fp = fopen (globals.fname, mode);
if (!fp)
fatal ("Can't open file");
return fp;
diff --git a/tools/winedump/output.c b/tools/winedump/output.c
index 0f88a19..8728501 100644
--- a/tools/winedump/output.c
+++ b/tools/winedump/output.c
@@ -493,7 +493,7 @@ void output_install_script (void)
OUTPUT_DLL_NAME, OUTPUT_DLL_NAME, OUTPUT_DLL_NAME, OUTPUT_DLL_NAME,
OUTPUT_DLL_NAME, OUTPUT_DLL_NAME, OUTPUT_DLL_NAME, OUTPUT_DLL_NAME);
- fchmod (fileno(install_file), 0755);
+ chmod (globals.fname, 0755);
fclose (install_file);
}
diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h
index d9ca8e0..169869e 100644
--- a/tools/winedump/winedump.h
+++ b/tools/winedump/winedump.h
@@ -72,6 +72,16 @@
#define SYM_THISCALL 0x4
#define SYM_DATA 0x8 /* Data, not a function */
+/* Lengh for the buffered output filenames */
+#ifdef MAX_PATH
+#if (MAX_PATH > 255)
+#define WINEDUMP_MAX_PATH MAX_PATH
+#endif
+#endif
+#ifndef WINEDUMP_MAX_PATH
+#define WINEDUMP_MAX_PATH 256
+#endif
+
typedef enum {NONE, DMGL, SPEC, DUMP, EMF, LNK} Mode;
/* Structure holding a parsed symbol */
@@ -138,6 +148,10 @@ typedef struct __globals
/* internal options */
int do_ordinals;
+
+ /* buffered output filename for chmod */
+ char fname[WINEDUMP_MAX_PATH];
+
} _globals;
extern _globals globals;
More information about the wine-patches
mailing list