Report the MD5 signature in the stderr output as well so that duplicate screen shots can be quickly identified. Of course this assumes that the exact same PNG is generated across different machine types and video cards. Currently I believe that it should given the hardware in question is virtualized.
The snprintf() was moved one up because it can change errno before calling perror(). This way the correct error message is printed if getaddrinfo() fails and both functions (perror () and gai_strerror()) are thread-safe.
Ironically, should the user specify invalid XML tag in cc_config.xml, BOINC will write log message containing that tag unescaped and unclosed. Needless to say, it breaks XML parsing instantly. This patch auto-closes this tag in the log message.
VS 2010 doesn't have snprintf().
As a temporary workaround (until we move to VS 2015)
#define snprintf as _snprintf (which doesn't null-terminate
if buffer is too small).
This is at least no worse than using sprintf(), which we were doing.
Apparently test/dead code gets flagged during a security audit as needing to be removed. I suppose it is assumed that everyone has switched over to using unit tests.
Except for very specific cases, strncpy() should never be used.
It can result in a non-terminated string.
Also replace strncat() with strlcat(); the latter is simpler
because you don't have to calculate remaining buffer space.
boinc_copy() is used in both client and server.
The chown/chmod was added Jan 6 2009,
apparently to deal with a client problem.
More recently, error checking was added to the chown/chmod calls.
On the server (e.g. sample assimilator) these fail,
and boinc_copy() returns error (even though the file was actually copied).
1) let's not overload functions. Functions in general should do 1 thing.
To this end, I moved the chown/chmod to a new function, boinc_copy_attributes().
2) It's not clear to me that we need the chown/chmod stuff,
either on client or server.
On the Unix client, we already have FILE_INFO::set_permissions(),
which sets the rwx bits of files copied into slot directories, as appropriate.
The chown() will be a no-op, since the client creates
both the original file (in project dir) and the copy.
So I'm not going to call boinc_copy_attributes() in the client.
Let's see if any problems arise in Unix with apps that
used <copy_file> for executables.
A small attempt at future proofing things. The value is 1 on my new GPU, but might not be on higher end cards. Docs implies it should be part of the calculation.
Use AMD's vendor specific extension if it is available to calculate the total number of shaders and determine the peak FLOP rate from that.
My new GPU I got for Christmas was only reporting 30% of its peak FLOP rate and does not support CAL.