diff options
author | Nicholas Clark <nick@ccl4.org> | 2010-07-28 11:01:51 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2010-07-28 11:01:51 +0100 |
commit | da1010ecc50c91387eed9bcc349e6960909a3484 (patch) | |
tree | 64250a5517609b41345cd9ca147facb1be24dfd2 /pp.c | |
parent | 1c761d95ce3e122676f2110e57e721b7689cd4c2 (diff) | |
download | perl-da1010ecc50c91387eed9bcc349e6960909a3484.tar.gz |
Make srand() return "0 but true" for 0, for backwards compatible behaviour.
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -2954,7 +2954,14 @@ PP(pp_srand) const UV anum = (MAXARG < 1) ? seed() : POPu; (void)seedDrand01((Rand_seed_t)anum); PL_srand_called = TRUE; - XPUSHu(anum); + if (anum) + XPUSHu(anum); + else { + /* Historically srand always returned true. We can avoid breaking + that like this: */ + sv_setpvs(TARG, "0 but true"); + XPUSHTARG; + } RETURN; } |