Make: Support shallow git clones for testing Since commit 1ec9b94, we derive the version number from git tags with build-aux/git-version-gen. When a shallow clone doesn't include a suitable tag, this fails, and make refuses to build anything. Since Travis uses git-clone --depth=50, it'll break as soon as we've got more than 50 commits since the last release. Support arbitrarily shallow clones for limited purposes like testing by falling back from a proper V.N-H version number to UNKNOWN-H. To guard against use of such builds for other purposes, log a warning on server startup, and print one on player login. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Change comment style to use @foo rather than FOO ... when referring to a function's parameter or a struct/union's member. The idea of using FOO comes from the GNU coding standards: The comment on a function is much clearer if you use the argument names to speak about the argument values. The variable name itself should be lower case, but write it in upper case when you are speaking about the value rather than the variable itself. Thus, "the inode number NODE_NUM" rather than "an inode". Upcasing names is problematic for a case-sensitive language like C, because it can create ambiguity. Moreover, it's too much shouting for my taste. GTK-Doc's convention to prefix the identifier with @ makes references to variables stand out nicely. The rest of the GTK-Doc conventions make no sense for us, however. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
update: Set thread stack size to 512 KiB Empire 2 settled on this formula for the stack size: stacksize = 100000 + /* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) + sizeof(char *)); Obviously attempts to provide space for a known configuration- dependent stack hog. The hog went away when finish_sects()'s arrays became dynamically allocated in 4.2.0. Adjusting for that by dropping the extra term might well do (I observe only a few KiB of stack used on my system). But let's set it to 512 KiB instead to be on the safe side. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
Fix PRNG seeding to resist guessing We seed it with value of time(). It's the traditional way, but it provides only a few bits of effective entropy when an attacker has a rough idea when the program started. Instead, seed with a kernel random number. If we can't get one, fall back to a hash of gettimeofday() and getpid(). This should happen only on old systems or Windows. Far worse than a kernel random number, but far better than using time(). Note that fairland used to seed with time() + getpid() until commit 331aac2a (v4.2.20) dropped the getpid(), claiming it didn't improve the randomness. Perhaps it didn't under Windows then, but it certainly did elsewhere, so it was a regression.