durusmail: quixote-users: uploading multiple files on OSX (Quixote 1.0b1)
uploading multiple files on OSX (Quixote 1.0b1)
uploading multiple files on OSX (Quixote 1.0b1)
Neil Schemenauer
2004-05-19
On Tue, May 18, 2004 at 10:14:08PM +0300, Ksenia Marasanova wrote:
>              try:
>                  fd = os.open(filename, flags)
>              except OSError, err:
> -                if err.strerror == errno.EAGAIN:
> +                if err.strerror == errno.EAGAIN or err.errno ==
> errno.EEXIST:
>                      # Filename collision -- try again
>                      counter += 1
>                  else:
>
> So there seems to be two differences on Panther:
>
> - err.strerror contains the actual error text "File Exists" and not the
> number
> - err.errno is different

I think the code was completely incorrect.  open() with the O_CREAT
and O_EXCL flags is supposed to return EEXIST if the file already
exists.  I checked both the Linux and FreeBSD manual pages.  Neither
page says anything about EAGAIN.  Using 'err.strerror' instead of
'err.errno' is also wrong.  So, I think the code should be simply:

    ...
        if err.errno == errno.EEXIST:
            ...

Thanks for reporting this bug.

  Neil


reply