Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #3817

Prevent unlink(...) warning

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Simon <bad@example.com>
Newsgroups comp.lang.php
Subject Prevent unlink(...) warning
Date Thu, 17 Nov 2011 17:04:13 +0200
Lines 35
Message-ID <9ikm3eFih4U1@mid.individual.net> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net ekuV0K85kqHUgbCCI+weqgDe9fAY7czB1piNtc3EnaPF4gyz91
Cancel-Lock sha1:asEIL/GfFxcafwSBhV5VQDsUAms=
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:3817

Show key headers only | View raw


Hi,

I am having some race condition issues on my server when trying to 
delete a file.

//
function my_unlink( $filename )
{
   //  remove the old file
   clearstatcache(TRUE, $filename);
   if (file_exists($filename))
   {
     @unlink($filename);
   }
   else
   {
     return true;
   }

   clearstatcache(TRUE, $filename);
   return (!file_exists($filename));  // check it was deleted.
}
//

In some cases I get

unlink(/home/xxx/public_html/temp/yyy.zz) [function.unlink]: No such 
file or directory

How can I prevent the warning?

Thanks

Simon

Back to comp.lang.php | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Prevent unlink(...) warning Simon <bad@example.com> - 2011-11-17 17:04 +0200
  Re: Prevent unlink(...) warning The Natural Philosopher <tnp@invalid.invalid> - 2011-11-17 15:18 +0000
    Re: Prevent unlink(...) warning Simon <bad@example.com> - 2011-11-17 19:21 +0200
      Re: Prevent unlink(...) warning The Natural Philosopher <tnp@invalid.invalid> - 2011-11-17 18:29 +0000
  Re: Prevent unlink(...) warning "Álvaro G. Vicario" <alvaro.NOSPAMTHANX@demogracia.com.invalid> - 2011-11-17 18:42 +0100
  Re: Prevent unlink(...) warning Jerry Stuckle <jstucklex@attglobal.net> - 2011-11-17 13:54 -0500

csiph-web