From 36dbd756bad7484e9245103db679e6e6de56d0c0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Thu, 6 Nov 2014 13:16:22 -0600 Subject: [PATCH] BAS: Conditional compile out use of ftruncate() --- interpreters/bas/Kconfig | 7 +++++++ interpreters/bas/fs.c | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/interpreters/bas/Kconfig b/interpreters/bas/Kconfig index b19e44d73..ae027d63c 100644 --- a/interpreters/bas/Kconfig +++ b/interpreters/bas/Kconfig @@ -49,4 +49,11 @@ config INTERPRETER_BAS_USE_SELECT bool "Use select()" default n +config INTERPRETER_BAS_HAVE_FTRUNCATE + bool + default n + ---help-- + NuttX does not currently support the ftruncate interface + + endif diff --git a/interpreters/bas/fs.c b/interpreters/bas/fs.c index b34aa1a90..790774543 100644 --- a/interpreters/bas/fs.c +++ b/interpreters/bas/fs.c @@ -813,6 +813,7 @@ int FS_lock(int chn, off_t offset, off_t length, int mode, int w) int FS_truncate(int chn) { +#ifdef CONFIG_INTERPRETER_BAS_HAVE_FTRUNCATE int fd; off_t o; @@ -843,6 +844,10 @@ int FS_truncate(int chn) } return 0; +#else + FS_errmsg = strerror(ENOSYS); + return -1; +#endif } void FS_shellmode(int dev)