On Mar 16 02:32, Charles Wilson wrote: > Here's revision 3. I've revised the UI to be more like what was > eventually accepted by binutils. One difference is that the ld options > allow only to set flags: > ld --tsaware > > With peflags we can set, clear, or display them: > peflags --tsaware : display > peflags --tsaware=1 : set > peflags --tsaware=0 : clear > > If this is more-or-less ok, I'll get started on the peflagsall script, > and send it all with updated docu as a patch for Jason to use in the > next rebase release. > > gcc -o peflags.exe -DVERSION='"2.4.5"' peflags.c
Looks good, except for three minor details I found. Patch attached. - The output is missing a trailing \n. - Error output is missing an error description: $ ./peflags --tsaware=1 /bin/tcsh Error: could not update pe characteristics (/bin/tcsh) Yes, but... why? The patch adds errno output, like this: $ ./peflags --tsaware=1 /bin/tcsh Error: could not update pe characteristics (/bin/tcsh): Device or resource busy - The get/set characteristics function are calling close(fd) even if open failed. This leads to wrong errno output after applying the above errno output. Corinna --- peflags.c.ORIG 2009-03-16 13:18:06.000000000 +0100 +++ peflags.c 2009-03-16 13:37:55.000000000 +0100 @@ -317,16 +317,16 @@ do_mark (const char *pathname) if (set_coff_characteristics (pathname,new_coff_characteristics) != 0) { fprintf (stderr, - "Error: could not update coff characteristics (%s)\n", - pathname); + "Error: could not update coff characteristics (%s): %s\n", + pathname, strerror (errno)); return 1; } if (new_pe_characteristics != old_pe_characteristics) if (set_pe_characteristics (pathname,new_pe_characteristics) != 0) { fprintf (stderr, - "Error: could not update pe characteristics (%s)\n", - pathname); + "Error: could not update pe characteristics (%s): %s\n", + pathname, strerror (errno)); return 1; } } @@ -393,6 +393,7 @@ do_mark (const char *pathname) else printf ("pe(0x%04x) ", old_pe_characteristics); } + puts (""); } return 0; @@ -704,7 +705,7 @@ get_characteristics(const char *pathname fd = open (pathname, O_RDONLY|O_BINARY); if (fd == -1) - goto done; + return status; if (pe_get32 (fd, 0x3c, &pe_header_offset) != 0) goto done; @@ -741,7 +742,7 @@ set_coff_characteristics(const char *pat get_characteristics already did that */ fd = open (pathname, O_RDWR|O_BINARY); if (fd == -1) - goto done; + return status; if (pe_get32 (fd, 0x3c, &pe_header_offset) != 0) goto done; @@ -774,7 +775,7 @@ set_pe_characteristics(const char *pathn get_characteristics already did that */ fd = open (pathname, O_RDWR|O_BINARY); if (fd == -1) - goto done; + return status; if (pe_get32 (fd, 0x3c, &pe_header_offset) != 0) goto done; -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/