diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/dfs/filesystems/elmfat/dfs_elm.c | 2 | ||||
| -rw-r--r-- | components/dfs/filesystems/nfs/dfs_nfs.c | 2 | ||||
| -rw-r--r-- | components/dfs/filesystems/romfs/dfs_romfs.c | 2 | ||||
| -rw-r--r-- | components/drivers/src/pipe.c | 12 | ||||
| -rw-r--r-- | components/finsh/shell.c | 2 | ||||
| -rw-r--r-- | components/libc/compilers/common/time.c | 9 | ||||
| -rw-r--r-- | components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c | 18 | ||||
| -rw-r--r-- | components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c | 18 |
8 files changed, 22 insertions, 43 deletions
diff --git a/components/dfs/filesystems/elmfat/dfs_elm.c b/components/dfs/filesystems/elmfat/dfs_elm.c index 07b8f62fed..41f99d7b62 100644 --- a/components/dfs/filesystems/elmfat/dfs_elm.c +++ b/components/dfs/filesystems/elmfat/dfs_elm.c @@ -647,7 +647,7 @@ int dfs_elm_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count) d->d_namlen = (rt_uint8_t)rt_strlen(fn); d->d_reclen = (rt_uint16_t)sizeof(struct dirent); - rt_strncpy(d->d_name, fn, rt_strlen(fn) + 1); + rt_strncpy(d->d_name, fn, DFS_PATH_MAX); index ++; if (index * sizeof(struct dirent) >= count) diff --git a/components/dfs/filesystems/nfs/dfs_nfs.c b/components/dfs/filesystems/nfs/dfs_nfs.c index e7ad488f7d..284d8d42af 100644 --- a/components/dfs/filesystems/nfs/dfs_nfs.c +++ b/components/dfs/filesystems/nfs/dfs_nfs.c @@ -1119,7 +1119,7 @@ int nfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count) d->d_namlen = rt_strlen(name); d->d_reclen = (rt_uint16_t)sizeof(struct dirent); - rt_strncpy(d->d_name, name, rt_strlen(name) + 1); + rt_strncpy(d->d_name, name, DFS_PATH_MAX); index ++; if (index * sizeof(struct dirent) >= count) diff --git a/components/dfs/filesystems/romfs/dfs_romfs.c b/components/dfs/filesystems/romfs/dfs_romfs.c index 1b2693fc3b..2e9b08cbf6 100644 --- a/components/dfs/filesystems/romfs/dfs_romfs.c +++ b/components/dfs/filesystems/romfs/dfs_romfs.c @@ -276,7 +276,7 @@ int dfs_romfs_getdents(struct dfs_fd *file, struct dirent *dirp, uint32_t count) d->d_namlen = rt_strlen(name); d->d_reclen = (rt_uint16_t)sizeof(struct dirent); - rt_strncpy(d->d_name, name, rt_strlen(name) + 1); + rt_strncpy(d->d_name, name, DFS_PATH_MAX); /* move to next position */ ++ file->pos; diff --git a/components/drivers/src/pipe.c b/components/drivers/src/pipe.c index 10b880ff7a..236c1ffec7 100644 --- a/components/drivers/src/pipe.c +++ b/components/drivers/src/pipe.c @@ -320,7 +320,7 @@ static const struct dfs_file_ops pipe_fops = }; #endif /* end of RT_USING_POSIX */ -rt_err_t rt_pipe_open (rt_device_t device, rt_uint16_t oflag) +rt_err_t rt_pipe_open(rt_device_t device, rt_uint16_t oflag) { rt_pipe_t *pipe = (rt_pipe_t *)device; rt_err_t ret = RT_EOK; @@ -348,7 +348,7 @@ __exit: return ret; } -rt_err_t rt_pipe_close (rt_device_t device) +rt_err_t rt_pipe_close(rt_device_t device) { rt_pipe_t *pipe = (rt_pipe_t *)device; @@ -366,7 +366,7 @@ rt_err_t rt_pipe_close (rt_device_t device) return RT_EOK; } -rt_size_t rt_pipe_read (rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count) +rt_size_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count) { uint8_t *pbuf; rt_size_t read_bytes = 0; @@ -394,7 +394,7 @@ rt_size_t rt_pipe_read (rt_device_t device, rt_off_t pos, void *buffer, rt_siz return read_bytes; } -rt_size_t rt_pipe_write (rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count) +rt_size_t rt_pipe_write(rt_device_t device, rt_off_t pos, const void *buffer, rt_size_t count) { uint8_t *pbuf; rt_size_t write_bytes = 0; @@ -531,8 +531,8 @@ int rt_pipe_delete(const char *name) int pipe(int fildes[2]) { rt_pipe_t *pipe; - char dname[8]; - char dev_name[32]; + char dname[RT_NAME_MAX]; + char dev_name[RT_NAME_MAX * 4]; static int pipeno = 0; rt_snprintf(dname, sizeof(dname), "pipe%d", pipeno++); diff --git a/components/finsh/shell.c b/components/finsh/shell.c index 0d41625184..6f1133bf3b 100644 --- a/components/finsh/shell.c +++ b/components/finsh/shell.c @@ -831,7 +831,7 @@ int finsh_system_init(void) __section_end("FSymTab")); finsh_system_var_init(__section_begin("VSymTab"), __section_end("VSymTab")); -#elif defined (__GNUC__) || defined(__TI_COMPILER_VERSION__) +#elif defined (__GNUC__) || defined(__TI_COMPILER_VERSION__) || defined(__TASKING__) /* GNU GCC Compiler and TI CCS */ extern const int __fsymtab_start; extern const int __fsymtab_end; diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c index 083ae9be6c..83b6ed5672 100644 --- a/components/libc/compilers/common/time.c +++ b/components/libc/compilers/common/time.c @@ -21,10 +21,15 @@ #include <sys/time.h> #include <rtthread.h> + #ifdef RT_USING_DEVICE #include <rtdevice.h> #endif +#define DBG_TAG "TIME" +#define DBG_LVL DBG_INFO +#include <rtdbg.h> + /* seconds per day */ #define SPD 24*60*60 @@ -219,6 +224,7 @@ RT_WEAK time_t time(time_t *t) if(time_now == (time_t)-1) { + LOG_W("Cannot find a RTC device to provide time!"); errno = ENOSYS; } @@ -246,12 +252,13 @@ int stime(const time_t *t) } else { + LOG_W("Cannot find a RTC device to provide time!"); errno = ENOSYS; return -1; } return 0; - #else + LOG_W("Cannot find a RTC device to provide time!"); errno = ENOSYS; return -1; #endif /* RT_USING_RTC */ diff --git a/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c b/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c index 129cc7da17..e14e34cfec 100644 --- a/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c +++ b/components/net/lwip-2.0.2/src/apps/tftp/tftp_port.c @@ -1,21 +1,7 @@ /* - * File : tftp_port.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes diff --git a/components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c b/components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c index 129cc7da17..e14e34cfec 100644 --- a/components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c +++ b/components/net/lwip-2.1.2/src/apps/tftp/tftp_port.c @@ -1,21 +1,7 @@ /* - * File : tftp_port.c - * This file is part of RT-Thread RTOS - * COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team + * Copyright (c) 2006-2021, RT-Thread Development Team * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes |
