|
|
@ -179,15 +179,15 @@ static int __dir_open(void *m, sexp_t *sx)
|
|
|
|
return sxmsg_return(msg, SNE_BADPROTO);
|
|
|
|
return sxmsg_return(msg, SNE_BADPROTO);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char *dir_name = sx->list->next->val;
|
|
|
|
char *dir_name = strdup(sx->list->next->val);
|
|
|
|
|
|
|
|
|
|
|
|
if ( usrtc_isfull(_rd_streams) ) {
|
|
|
|
if ( usrtc_isfull(_rd_streams) ) {
|
|
|
|
return sxmsg_return(msg, EINVAL);
|
|
|
|
return sxmsg_return(msg, SNE_TOOLONG);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
datastream_t *item;
|
|
|
|
datastream_t *item;
|
|
|
|
if ( !(item = malloc(sizeof(datastream_t))) ) {
|
|
|
|
if ( !(item = malloc(sizeof(datastream_t))) ) {
|
|
|
|
return sxmsg_return(msg, ENOMEM);
|
|
|
|
return sxmsg_return(msg, SNE_ENOMEM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* find free id */
|
|
|
|
/* find free id */
|
|
|
@ -204,7 +204,7 @@ static int __dir_open(void *m, sexp_t *sx)
|
|
|
|
if ( !(dp = opendir(dir_name)) ) {
|
|
|
|
if ( !(dp = opendir(dir_name)) ) {
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
free(item);
|
|
|
|
free(item);
|
|
|
|
return sxmsg_return(msg, EINVAL);
|
|
|
|
return sxmsg_return(msg, SNE_FAILED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* init stream */
|
|
|
|
/* init stream */
|
|
|
@ -253,7 +253,7 @@ static int __dir_read(void *m, sexp_t *sx)
|
|
|
|
pthread_rwlock_rdlock(&_lock);
|
|
|
|
pthread_rwlock_rdlock(&_lock);
|
|
|
|
if ( !(node = usrtc_lookup(_rd_streams, &stid)) ) {
|
|
|
|
if ( !(node = usrtc_lookup(_rd_streams, &stid)) ) {
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
return sxmsg_return(msg, ENOENT);
|
|
|
|
return sxmsg_return(msg, SNE_INVALINDEX);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
|
|
|
|
|
|
|
@ -264,7 +264,7 @@ static int __dir_read(void *m, sexp_t *sx)
|
|
|
|
printf("%s: readdir_r() is failed (%d)\n", __FUNCTION__, errno);
|
|
|
|
printf("%s: readdir_r() is failed (%d)\n", __FUNCTION__, errno);
|
|
|
|
#endif /* DEBUG */
|
|
|
|
#endif /* DEBUG */
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
pthread_rwlock_unlock(&_lock);
|
|
|
|
return sxmsg_return(msg, EINVAL);
|
|
|
|
return sxmsg_return(msg, SNE_FAILED);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!item->dres) {
|
|
|
|
if (!item->dres) {
|
|
|
|