[haiku] Re: File system races?

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku@xxxxxxxxxxxxx
  • Date: Sun, 6 Aug 2017 21:55:42 +0200

Am 06/08/2017 um 13:35 schrieb David Given:

So I reckon there are two bugs here:

(a) I shouldn't be using mktemp(); I should be using mkstemp() instead which atomically creates the file, guaranteeing uniqueness --- although in fairness, most of this code was written in the 1980s, when mkstemp() didn't exist;

Yep, switching to mkstemp() definitely makes sense. Massively parallel builds weren't en vogue back then either :-)

(b) Haiku really shouldn't be doing that.

Yes, it probably shouldn't. Current BSD implementations have replaced rand() with arc4random_uniform(); while mkstemp() doesn't suffer from the race condition, it still uses the same random name generator.

Could you please file a bug report about this?


Other related posts: