wrong file open mode "PJ_O_APPEND"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Xu Bin,

>From the doc:
"Value PJ_O_APPEND can only be used when the file is opened for writing."
And:
"The flag must be either PJ_O_RDONLY, PJ_O_WRONLY, or PJ_O_RDWR. When file
writing is specified, existing file will be truncated unless
PJ_O_APPEND is specified."

So our spec requires PJ_O_APPEND to be masked with PJ_O_WRONLY.

Regards,
Ming

On Wed, Jul 18, 2012 at 2:21 PM, xu bin <funyheme at gmail.com> wrote:
> Hi,
> I try to open a file with "PJ_O_APPEND" mode in android system,
> but I got "PJ_EINVAL".
> I hacked in the source codes and found the reason:
>
> in "pj/file_io.h" file:
> PJ_O_APPEND     = 0x1108
>
> and in "pj/file_io_ansi.c":
> if ((flags & PJ_O_WRONLY) == PJ_O_WRONLY) {
>             *p++ = 'a';
>             if ((flags & PJ_O_RDONLY) == PJ_O_RDONLY)
>                 *p++ = '+';
>         }
>
> when the flags = PJ_O_APPEND,  the conditions are false,
> so no values are set to p, and then goto the following line:
> if (p==mode)
>         return PJ_EINVAL;
>
> this is why I got PJ_EINVAL when I set mode "PJ_O_APPEND".
>
> And the pjsip version is realsed 2.x.
>
> Is this a bug or is there something I got wrong?
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>



[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux