提交 3022725f 编写于 作者: B Bernard Xiong

Merge pull request #262 from grissiom/misc-fix

Misc fix
......@@ -85,6 +85,8 @@ struct dfs_filesystem *dfs_filesystem_lookup(const char *path)
prefixlen = 0;
RT_ASSERT(path);
/* lock filesystem */
dfs_lock();
......
......@@ -508,10 +508,10 @@ static void token_proc_number(struct finsh_token* self)
*p = '\0';
}
else
else if ( '0' <= ch && ch <= '7' )
{
b = 8;
while ( is_digit(ch) )
while ( '0' <= ch && ch <= '7' )
{
*p++ = ch;
ch = token_next_char(self);
......@@ -519,6 +519,12 @@ static void token_proc_number(struct finsh_token* self)
*p = '\0';
}
else
{
/* Not a valid number */
token_prev_char(self);
return;
}
self->value.int_value = token_spec_number(buf, strlen(buf), b);
self->current_token = finsh_token_type_value_int;
......
......@@ -358,7 +358,6 @@ void msh_auto_complete_path(char *path)
full_path = (char*)rt_malloc(256);
if (full_path == RT_NULL) return; /* out of memory */
ptr = full_path;
if (*path != '/')
{
getcwd(full_path, 256);
......@@ -367,7 +366,8 @@ void msh_auto_complete_path(char *path)
}
else *full_path = '\0';
index = RT_NULL; ptr = path;
index = RT_NULL;
ptr = path;
for (;;)
{
if (*ptr == '/') index = ptr + 1; if (!*ptr) break; ptr ++;
......
......@@ -146,10 +146,10 @@ int strncasecmp ( const char* s1, const char* s2, size_t len )
x1 = *s1 - 'A'; if ((x1 < 26u)) x1 += 32;
s1++; s2++;
if ((x2 != x1))
if (x2 != x1)
break;
if ((x1 == (unsigned int)-'A'))
if (x1 == (unsigned int)-'A')
break;
}
......
......@@ -119,7 +119,6 @@ mqd_t mq_open(const char *name, int oflag, ...)
{
mqd_t mqdes;
va_list arg;
mode_t mode;
struct mq_attr *attr = RT_NULL;
/* lock posix mqueue list */
......@@ -129,8 +128,6 @@ mqd_t mq_open(const char *name, int oflag, ...)
if (oflag & O_CREAT)
{
va_start(arg, oflag);
mode = (mode_t)va_arg(arg, unsigned int);
mode = mode;
attr = (struct mq_attr *)va_arg(arg, struct mq_attr *);
va_end(arg);
......
......@@ -101,7 +101,7 @@ int pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
{
result = EBUSY;
return(EBUSY);
return result;
}
else
{
......
......@@ -224,7 +224,6 @@ sem_t *sem_open(const char *name, int oflag, ...)
{
sem_t* sem;
va_list arg;
mode_t mode;
unsigned int value;
sem = RT_NULL;
......@@ -234,7 +233,6 @@ sem_t *sem_open(const char *name, int oflag, ...)
if (oflag & O_CREAT)
{
va_start(arg, oflag);
mode = (mode_t) va_arg( arg, unsigned int); mode = mode;
value = va_arg( arg, unsigned int);
va_end(arg);
......
......@@ -7,6 +7,7 @@
* 一个线程定时发送事件 (事件5)
*/
#include <rtthread.h>
#include <time.h>
#include "tc_comm.h"
/* 指向线程控制块的指针 */
......
......@@ -60,6 +60,10 @@ static void thread3_entry(void* parameter)
while (1)
{
result = rt_mutex_take(mutex, RT_WAITING_FOREVER);
if (result != RT_EOK)
{
tc_stat(TC_STAT_END | TC_STAT_FAILED);
}
result = rt_mutex_take(mutex, RT_WAITING_FOREVER);
if (result != RT_EOK)
{
......
......@@ -178,8 +178,14 @@ static void worker_entry(void* parameter)
/* 持有信号量 */
rt_sem_take(sem, RT_WAITING_FOREVER);
/* 把数据放到环形buffer中 */
result = rb_put(&working_rb, &data_buffer[0], BUFFER_ITEM);
if (result == RT_FALSE)
{
rt_kprintf("put error\n");
}
/* 释放信号量 */
rt_sem_release(sem);
......
......@@ -59,6 +59,7 @@ void consumer_thread_entry(void* parameter)
/* 第n个线程,由入口参数传进来 */
no = (rt_uint32_t)parameter;
sum = 0;
while(1)
{
/* 获取一个满位 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册