change log for rtems (2010-06-08)

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Jun 8 13:28:17 UTC 2010


On 06/08/2010 03:22 PM, Chris Johns wrote:
> On 8/06/10 11:11 PM, rtems-vc at rtems.org wrote:
>> +
>> +int
>> +rtems_mkdir(const char *path, mode_t mode)
>> +{
>> +    int success = 0;
> 
> Should this be set to 1 and errno to ENOMEM ?

According to POSIX strdup() sets errno to ENOMEM.

> 
>> +    char *dup_path = strdup(path);
>> +
>> +    if (dup_path != NULL) {
>> +        success = build(dup_path, mode);
>> +        free(dup_path);
>> +    }
>> +
>> +    return success != 0 ? 0 : -1;
>> +}
> 
> My reading is a failed strdup has no error returned. Is this expected ?

If dup_path == NULL, success == 0 and thus -1 will be returned.

The success value is a bit confusing, but I wanted to use the FreeBSD code more
or less one-to-one.

> 
> Chris
> _______________________________________________
> rtems-vc mailing list
> rtems-vc at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-vc


-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the vc mailing list