Commit 4cecf2f4 authored by ivo's avatar ivo

Include the PID in the RNG seed to get a unique serial. We are using getpid()...

Include the PID in the RNG seed to get a unique serial.  We are using getpid() here, since I heard contradictory statements regarding Windows support of getpid(); will add a _getpid() on a #ifdef WIN32 if it turns out it doesn't work on Windows.  Patch by Michael Gold.  Closes #1432

svn path=/trunk/vorbis-tools/; revision=15375
parent 52fa3d74
......@@ -11,7 +11,7 @@ vorbis-tools 1.3.0 -- Unreleased
* ogg123: backported fix from libfishsound to patch the Speex decoder (#1347)
* ogg123: fixed CPU issue when outputting to a closed pipe (#1357)
* ogg123: return value to stop decoding after buffer is shut down (#1357)
* ogg123: support for ReplayGain (#381)
* ogg123: support for ReplayGain; requires libvorbis 1.2.1 or later (#381)
* oggdec: gettextized help text (#1385)
* oggdec: gettextized all strings
* oggdec: call ov_open_callbacks instead of ov_open; it works on Windows now
......@@ -25,6 +25,7 @@ vorbis-tools 1.3.0 -- Unreleased
* oggenc: --utf8 command similar to vorbiscomment's --raw (#268)
* oggenc: fixed the encoding of extended characters in Windows (#268)
* oggenc: validate raw UTF-8 sent to oggenc (#268)
* oggenc: include the PID in the RNG seed to get a unique serial (#1432)
* ogginfo: support for information in Kate streams (#1360)
* vcut: 64 bit fixes (#1366)
* vorbiscomment: correct memory allocation (#472)
......
......@@ -21,6 +21,11 @@
#include <time.h>
#include <locale.h>
#include <errno.h>
#include <sys/types.h>
#include <unistd.h>
#if defined WIN32 || defined _WIN32
#include <process.h>
#endif
#include "platform.h"
#include "encode.h"
......@@ -128,8 +133,10 @@ int main(int argc, char **argv)
if(!opt.fixedserial)
{
/* We randomly pick a serial number. This is then incremented for each file */
srand(time(NULL));
/* We randomly pick a serial number. This is then incremented for each
file. The random seed includes the PID so two copies of oggenc that
start in the same second will generate different serial numbers. */
srand(time(NULL) ^ getpid());
opt.serial = rand();
opt.skeleton_serial = opt.serial + numfiles;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment