This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Analyzing a SEG FAULT that gdb doesn't help with

On Sat, Aug 1, 2015 at 1:28 PM, Brian Inglis  wrote:
> Seems like the problem may be developer confusion between strftime and
> printf conversion flag prefixes. The strftime space conversion flag
> character is _ so space filled seconds should use %_S, whereas the printf
> conversion flag character is space ' ', though I can't recall ever using
> that, as it is normally the default.
Well this code is not related to the strftime code in my other thread.
In this case it was just that a programmer didn't understand why
people do printf("%s",string) instead of printf(string). The program
takes lines out of log files, snarfs information out of them and makes
a report. Sometimes what belongs in the report is a copy of the entire
line from the log, so printf(line). But that would seem unwise in
general. In particular these log lines have prompts in them, and as
you know prompts often have '%' characters in them. It was only a
matter of time before this habit became a bad one.

So my email above is really the conclusion of the investigation, and
the fix is for me to switch the code to fputs in such cases.

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]