mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
Reserver the name 'err' for other purposes
This commit is contained in:
parent
468bdcf8e6
commit
e82a54bf18
18 changed files with 100 additions and 94 deletions
|
|
@ -387,7 +387,7 @@ int ajoy_main(int argc, char *argv[])
|
|||
int fd;
|
||||
int tmp;
|
||||
int ret;
|
||||
int err = EXIT_FAILURE;
|
||||
int errcode = EXIT_FAILURE;
|
||||
|
||||
/* Reset some globals that might been been left in a bad state */
|
||||
|
||||
|
|
@ -459,9 +459,9 @@ int ajoy_main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
err = EXIT_SUCCESS;
|
||||
errcode = EXIT_SUCCESS;
|
||||
|
||||
errout_with_fd:
|
||||
close(fd);
|
||||
return err;
|
||||
return errcode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ static int configdata_verifyconfig(void)
|
|||
{
|
||||
FAR struct configdata_entrydesc_s *entry;
|
||||
int ret;
|
||||
int err = OK;
|
||||
int errcode = OK;
|
||||
int i;
|
||||
static int iteration = 0;
|
||||
|
||||
|
|
@ -441,7 +441,7 @@ static int configdata_verifyconfig(void)
|
|||
printf("ERROR: Failed to read an entry: %d\n", i);
|
||||
printf(" Entry id: %04X\n", entry->id);
|
||||
printf(" Entry size: %d\n", entry->len);
|
||||
err = ERROR;
|
||||
errcode = ERROR;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -453,7 +453,7 @@ static int configdata_verifyconfig(void)
|
|||
printf("ERROR: Succesffully read a deleted entry\n");
|
||||
printf(" Entry id: %04X\n", entry->id);
|
||||
printf(" Entry size: %d\n", entry->len);
|
||||
err = ERROR;
|
||||
errcode = ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -466,7 +466,7 @@ static int configdata_verifyconfig(void)
|
|||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
return errcode;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ int djoy_main(int argc, char *argv[])
|
|||
int fd;
|
||||
int tmp;
|
||||
int ret;
|
||||
int err = EXIT_FAILURE;
|
||||
int errcode = EXIT_FAILURE;
|
||||
|
||||
/* Reset some globals that might been been left in a bad state */
|
||||
|
||||
|
|
@ -248,9 +248,9 @@ int djoy_main(int argc, char *argv[])
|
|||
g_djoylast = newset;
|
||||
}
|
||||
|
||||
err = EXIT_SUCCESS;
|
||||
errcode = EXIT_SUCCESS;
|
||||
|
||||
errout_with_fd:
|
||||
close(fd);
|
||||
return err;
|
||||
return errcode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -107,18 +107,18 @@
|
|||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG_FEATURES
|
||||
# define message(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define err(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define errmsg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# else
|
||||
# define message(format, ...) printf(format, ##__VA_ARGS__)
|
||||
# define err(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
# define errmsg(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG_FEATURES
|
||||
# define message dbg
|
||||
# define err dbg
|
||||
# define errmsg dbg
|
||||
# else
|
||||
# define message printf
|
||||
# define err printf
|
||||
# define errmsg printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ int elf_main(int argc, char *argv[])
|
|||
ret = elf_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Initialization of the ELF loader failed: %d\n", ret);
|
||||
errmsg("ERROR: Initialization of the ELF loader failed: %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ int elf_main(int argc, char *argv[])
|
|||
NSECTORS(romfs_img_len), SECTORSIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: romdisk_register failed: %d\n", ret);
|
||||
errmsg("ERROR: romdisk_register failed: %d\n", ret);
|
||||
elf_uninitialize();
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -269,8 +269,8 @@ int elf_main(int argc, char *argv[])
|
|||
ret = mount(CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: mount(%s,%s,romfs) failed: %s\n",
|
||||
CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno);
|
||||
errmsg("ERROR: mount(%s,%s,romfs) failed: %s\n",
|
||||
CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno);
|
||||
elf_uninitialize();
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ int elf_main(int argc, char *argv[])
|
|||
ret = load_module(&bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Failed to load program '%s'\n", dirlist[i]);
|
||||
errmsg("ERROR: Failed to load program '%s'\n", dirlist[i]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -333,7 +333,7 @@ int elf_main(int argc, char *argv[])
|
|||
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Failed to execute program '%s'\n", dirlist[i]);
|
||||
errmsg("ERROR: Failed to execute program '%s'\n", dirlist[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -318,21 +318,22 @@ static inline int fstest_wrfile(FAR struct fstest_filedesc_s *file)
|
|||
nbyteswritten = write(fd, &g_fileimage[offset], nbytestowrite);
|
||||
if (nbyteswritten < 0)
|
||||
{
|
||||
int err = errno;
|
||||
int errcode = errno;
|
||||
|
||||
/* If the write failed because there is no space on the device,
|
||||
* then don't complain.
|
||||
*/
|
||||
|
||||
if (err != ENOSPC)
|
||||
if (errcode != ENOSPC)
|
||||
{
|
||||
printf("ERROR: Failed to write file: %d\n", err);
|
||||
printf("ERROR: Failed to write file: %d\n", errcode);
|
||||
printf(" File name: %s\n", file->name);
|
||||
printf(" File size: %d\n", file->len);
|
||||
printf(" Write offset: %ld\n", (long)offset);
|
||||
printf(" Write size: %ld\n", (long)nbytestowrite);
|
||||
ret = ERROR;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
/* Remove any garbage file that might have been left behind */
|
||||
|
|
|
|||
|
|
@ -351,15 +351,15 @@ static inline int nxffs_wrfile(FAR struct nxffs_filedesc_s *file)
|
|||
nbyteswritten = write(fd, &g_fileimage[offset], nbytestowrite);
|
||||
if (nbyteswritten < 0)
|
||||
{
|
||||
int err = errno;
|
||||
int errcode = errno;
|
||||
|
||||
/* If the write failed because there is no space on the device,
|
||||
* then don't complain.
|
||||
*/
|
||||
|
||||
if (err != ENOSPC)
|
||||
if (errcode != ENOSPC)
|
||||
{
|
||||
printf("ERROR: Failed to write file: %d\n", err);
|
||||
printf("ERROR: Failed to write file: %d\n", errcode);
|
||||
printf(" File name: %s\n", file->name);
|
||||
printf(" File size: %lu\n", (unsigned long)file->len);
|
||||
printf(" Write offset: %ld\n", (long)offset);
|
||||
|
|
|
|||
|
|
@ -103,18 +103,18 @@
|
|||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG_FEATURES
|
||||
# define message(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define err(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define errmsg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# else
|
||||
# define message(format, ...) printf(format, ##__VA_ARGS__)
|
||||
# define err(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
# define errmsg(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG_FEATURES
|
||||
# define message dbg
|
||||
# define err dbg
|
||||
# define errmsg dbg
|
||||
# else
|
||||
# define message printf
|
||||
# define err printf
|
||||
# define errmsg printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ int nxflat_main(int argc, char *argv[])
|
|||
ret = nxflat_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret);
|
||||
errmsg("ERROR: Initialization of the NXFLAT loader failed: %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ int nxflat_main(int argc, char *argv[])
|
|||
ret = romdisk_register(0, (FAR uint8_t *)romfs_img, NSECTORS(romfs_img_len), SECTORSIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: romdisk_register failed: %d\n", ret);
|
||||
errmsg("ERROR: romdisk_register failed: %d\n", ret);
|
||||
nxflat_uninitialize();
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -193,8 +193,8 @@ int nxflat_main(int argc, char *argv[])
|
|||
ret = mount(ROMFSDEV, MOUNTPT, "romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: mount(%s,%s,romfs) failed: %s\n",
|
||||
ROMFSDEV, MOUNTPT, errno);
|
||||
errmsg("ERROR: mount(%s,%s,romfs) failed: %s\n",
|
||||
ROMFSDEV, MOUNTPT, errno);
|
||||
nxflat_uninitialize();
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +241,7 @@ int nxflat_main(int argc, char *argv[])
|
|||
ret = load_module(&bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Failed to load program '%s'\n", dirlist[i]);
|
||||
errmsg("ERROR: Failed to load program '%s'\n", dirlist[i]);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ int nxflat_main(int argc, char *argv[])
|
|||
ret = exec_module(&bin);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Failed to execute program '%s'\n", dirlist[i]);
|
||||
errmsg("ERROR: Failed to execute program '%s'\n", dirlist[i]);
|
||||
unload_module(&bin);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -110,18 +110,18 @@
|
|||
#ifdef CONFIG_CPP_HAVE_VARARGS
|
||||
# ifdef CONFIG_DEBUG_FEATURES
|
||||
# define message(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define err(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# define errmsg(format, ...) dbg(format, ##__VA_ARGS__)
|
||||
# else
|
||||
# define message(format, ...) printf(format, ##__VA_ARGS__)
|
||||
# define err(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
# define errmsg(format, ...) fprintf(stderr, format, ##__VA_ARGS__)
|
||||
# endif
|
||||
#else
|
||||
# ifdef CONFIG_DEBUG_FEATURES
|
||||
# define message dbg
|
||||
# define err dbg
|
||||
# define errmsg dbg
|
||||
# else
|
||||
# define message printf
|
||||
# define err printf
|
||||
# define errmsg printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = elf_initialize();
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: Initialization of the ELF loader failed: %d\n", ret);
|
||||
errmsg("ERROR: Initialization of the ELF loader failed: %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -257,7 +257,7 @@ int spawn_main(int argc, char *argv[])
|
|||
NSECTORS(romfs_img_len), SECTORSIZE);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: romdisk_register failed: %d\n", ret);
|
||||
errmsg("ERROR: romdisk_register failed: %d\n", ret);
|
||||
elf_uninitialize();
|
||||
exit(1);
|
||||
}
|
||||
|
|
@ -272,8 +272,8 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = mount(CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL);
|
||||
if (ret < 0)
|
||||
{
|
||||
err("ERROR: mount(%s,%s,romfs) failed: %s\n",
|
||||
CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno);
|
||||
errmsg("ERROR: mount(%s,%s,romfs) failed: %s\n",
|
||||
CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno);
|
||||
elf_uninitialize();
|
||||
}
|
||||
|
||||
|
|
@ -307,14 +307,14 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn_file_actions_init(&file_actions);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn_file_actions_init failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn_file_actions_init failed: %d\n", ret);
|
||||
}
|
||||
posix_spawn_file_actions_dump(&file_actions);
|
||||
|
||||
ret = posix_spawnattr_init(&attr);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawnattr_init failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawnattr_init failed: %d\n", ret);
|
||||
}
|
||||
posix_spawnattr_dump(&attr);
|
||||
|
||||
|
|
@ -340,7 +340,7 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn(&pid, filepath, &file_actions, &attr, NULL, (FAR char * const*)&g_argv);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn failed: %d\n", ret);
|
||||
}
|
||||
|
||||
sleep(4);
|
||||
|
|
@ -351,14 +351,14 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn_file_actions_destroy(&file_actions);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn_file_actions_destroy failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn_file_actions_destroy failed: %d\n", ret);
|
||||
}
|
||||
posix_spawn_file_actions_dump(&file_actions);
|
||||
|
||||
ret = posix_spawnattr_destroy(&attr);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawnattr_destroy failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawnattr_destroy failed: %d\n", ret);
|
||||
}
|
||||
posix_spawnattr_dump(&attr);
|
||||
|
||||
|
|
@ -379,14 +379,14 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn_file_actions_init(&file_actions);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn_file_actions_init failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn_file_actions_init failed: %d\n", ret);
|
||||
}
|
||||
posix_spawn_file_actions_dump(&file_actions);
|
||||
|
||||
ret = posix_spawnattr_init(&attr);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawnattr_init failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawnattr_init failed: %d\n", ret);
|
||||
}
|
||||
posix_spawnattr_dump(&attr);
|
||||
|
||||
|
|
@ -397,7 +397,7 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn_file_actions_addclose(&file_actions, 0);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn_file_actions_addclose failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn_file_actions_addclose failed: %d\n", ret);
|
||||
}
|
||||
posix_spawn_file_actions_dump(&file_actions);
|
||||
|
||||
|
|
@ -405,7 +405,7 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn_file_actions_addopen(&file_actions, 0, fullpath, O_RDONLY, 0644);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret);
|
||||
}
|
||||
posix_spawn_file_actions_dump(&file_actions);
|
||||
|
||||
|
|
@ -431,7 +431,7 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn(&pid, filepath, &file_actions, &attr, NULL, NULL);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn failed: %d\n", ret);
|
||||
}
|
||||
|
||||
sleep(2);
|
||||
|
|
@ -442,14 +442,14 @@ int spawn_main(int argc, char *argv[])
|
|||
ret = posix_spawn_file_actions_destroy(&file_actions);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawn_file_actions_destroy failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawn_file_actions_destroy failed: %d\n", ret);
|
||||
}
|
||||
posix_spawn_file_actions_dump(&file_actions);
|
||||
|
||||
ret = posix_spawnattr_destroy(&attr);
|
||||
if (ret != 0)
|
||||
{
|
||||
err("ERROR: posix_spawnattr_destroy failed: %d\n", ret);
|
||||
errmsg("ERROR: posix_spawnattr_destroy failed: %d\n", ret);
|
||||
}
|
||||
posix_spawnattr_dump(&attr);
|
||||
|
||||
|
|
|
|||
|
|
@ -356,21 +356,22 @@ static inline int smart_wrfile(FAR struct smart_filedesc_s *file)
|
|||
nbyteswritten = write(fd, &g_fileimage[offset], nbytestowrite);
|
||||
if (nbyteswritten < 0)
|
||||
{
|
||||
int err = errno;
|
||||
int errcode = errno;
|
||||
|
||||
/* If the write failed because there is no space on the device,
|
||||
* then don't complain.
|
||||
*/
|
||||
|
||||
if (err != ENOSPC)
|
||||
if (errcode != ENOSPC)
|
||||
{
|
||||
printf("ERROR: Failed to write file: %d\n", err);
|
||||
printf("ERROR: Failed to write file: %d\n", errcode);
|
||||
printf(" File name: %s\n", file->name);
|
||||
printf(" File size: %d\n", file->len);
|
||||
printf(" Write offset: %ld\n", (long)offset);
|
||||
printf(" Write size: %ld\n", (long)nbytestowrite);
|
||||
ret = ERROR;
|
||||
}
|
||||
|
||||
close(fd);
|
||||
|
||||
/* Remove any garbage file that might have been left behind */
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ int zerocross_main(int argc, char *argv[])
|
|||
int fd;
|
||||
int tmp;
|
||||
int ret;
|
||||
int err = EXIT_FAILURE;
|
||||
int errcode = EXIT_FAILURE;
|
||||
|
||||
/* Open the zerocross device */
|
||||
|
||||
|
|
@ -140,9 +140,9 @@ int zerocross_main(int argc, char *argv[])
|
|||
printf("Sample = %d\n", value.si_value.sival_int);
|
||||
}
|
||||
|
||||
err = EXIT_SUCCESS;
|
||||
errcode = EXIT_SUCCESS;
|
||||
|
||||
errout_with_fd:
|
||||
close(fd);
|
||||
return err;
|
||||
return errcode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ static int cat(const char *filename)
|
|||
int fd;
|
||||
char buf[4096];
|
||||
ssize_t l;
|
||||
int err;
|
||||
int errcode;
|
||||
|
||||
if ((fd = open(filename, O_RDONLY)) == -1)
|
||||
{
|
||||
|
|
@ -189,9 +189,9 @@ static int cat(const char *filename)
|
|||
{
|
||||
if ((w = write(1, buf + off, l - off)) == -1)
|
||||
{
|
||||
err = errno;
|
||||
errcode = errno;
|
||||
close(fd);
|
||||
errno = err;
|
||||
errno = errcode;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
@ -201,9 +201,9 @@ static int cat(const char *filename)
|
|||
|
||||
if (l == -1)
|
||||
{
|
||||
err = errno;
|
||||
errcode = errno;
|
||||
close(fd);
|
||||
errno = err;
|
||||
errno = errcode;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -671,10 +671,11 @@ void Program_PCtoError(struct Program *this, struct Pc *pc, struct Value *v)
|
|||
struct Value *Program_merge(struct Program *this, int dev, struct Value *value)
|
||||
{
|
||||
struct String s;
|
||||
int l, err = 0;
|
||||
int l;
|
||||
int errcode = 0;
|
||||
|
||||
l = 0;
|
||||
while (String_new(&s), (err = FS_appendToString(dev, &s, 1)) != -1 &&
|
||||
while (String_new(&s), (errcode = FS_appendToString(dev, &s, 1)) != -1 &&
|
||||
s.length)
|
||||
{
|
||||
struct Token *line;
|
||||
|
|
@ -702,7 +703,7 @@ struct Value *Program_merge(struct Program *this, int dev, struct Value *value)
|
|||
}
|
||||
|
||||
String_destroy(&s);
|
||||
if (err)
|
||||
if (errcode)
|
||||
{
|
||||
return Value_new_ERROR(value, IOERROR, FS_errmsg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,9 +271,10 @@ struct Value *stmt_CASE(struct Value *value)
|
|||
|
||||
struct Value *stmt_CHDIR_MKDIR(struct Value *value)
|
||||
{
|
||||
int res = -1, err = -1;
|
||||
struct Pc dirpc;
|
||||
struct Pc statementpc = g_pc;
|
||||
int res = -1;
|
||||
int errcode = -1;
|
||||
|
||||
++g_pc.token;
|
||||
dirpc = g_pc;
|
||||
|
|
@ -299,14 +300,14 @@ struct Value *stmt_CHDIR_MKDIR(struct Value *value)
|
|||
assert(0);
|
||||
}
|
||||
|
||||
err = errno;
|
||||
errcode = errno;
|
||||
}
|
||||
|
||||
Value_destroy(value);
|
||||
if (g_pass == INTERPRET && res == -1)
|
||||
{
|
||||
g_pc = dirpc;
|
||||
return Value_new_ERROR(value, IOERROR, strerror(err));
|
||||
return Value_new_ERROR(value, IOERROR, strerror(errcode));
|
||||
}
|
||||
|
||||
return (struct Value *)0;
|
||||
|
|
|
|||
|
|
@ -270,9 +270,9 @@ static int lesp_low_level_read(uint8_t* buf, int size)
|
|||
ret = poll(fds, 1, lespPOLLING_TIME_MS);
|
||||
if (ret < 0)
|
||||
{
|
||||
int err = errno;
|
||||
ndbg("worker read Error %d (errno %d)\n", ret, err);
|
||||
UNUSED(err);
|
||||
int errcode = errno;
|
||||
ndbg("worker read Error %d (errno %d)\n", ret, errcode);
|
||||
UNUSED(errcode);
|
||||
}
|
||||
else if ((fds[0].revents & POLLERR) && (fds[0].revents & POLLHUP))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
||||
{
|
||||
FAR struct ftpc_session_s *session = (FAR struct ftpc_session_s *)handle;
|
||||
int err;
|
||||
int errcode;
|
||||
int ret;
|
||||
|
||||
/* Verify that we are connected to a server */
|
||||
|
|
@ -90,7 +90,7 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
|||
if (!ftpc_connected(session))
|
||||
{
|
||||
ndbg("Not connected\n");
|
||||
err = ENOTCONN;
|
||||
errcode = ENOTCONN;
|
||||
goto errout_with_err;
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
|||
if (ftpc_loggedin(session))
|
||||
{
|
||||
ndbg("Already logged in\n");
|
||||
err = EINVAL;
|
||||
errcode = EINVAL;
|
||||
goto errout_with_err;
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ int ftpc_login(SESSION handle, FAR struct ftpc_login_s *login)
|
|||
return OK;
|
||||
|
||||
errout_with_err:
|
||||
set_errno(err);
|
||||
set_errno(errcode);
|
||||
errout:
|
||||
return ERROR;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ int main(int argc, char *argv[])
|
|||
char *cp = 0;
|
||||
FILE *fp;
|
||||
char *star;
|
||||
int err = 0;
|
||||
int errcode = 0;
|
||||
|
||||
/* Get the name that we were run as, which is the filename being **
|
||||
* redirected.
|
||||
|
|
@ -195,7 +195,7 @@ int main(int argc, char *argv[])
|
|||
if (fp == (FILE *) 0)
|
||||
{
|
||||
internal_error("Couldn't open .redirects file.");
|
||||
err = 3;
|
||||
errcode = 3;
|
||||
goto errout_with_cp;
|
||||
}
|
||||
|
||||
|
|
@ -260,7 +260,7 @@ int main(int argc, char *argv[])
|
|||
/* No match found. */
|
||||
|
||||
not_found(script_name);
|
||||
err = 4;
|
||||
errcode = 4;
|
||||
|
||||
success_out:
|
||||
fclose(fp);
|
||||
|
|
@ -269,5 +269,6 @@ errout_with_cp:
|
|||
{
|
||||
free(cp);
|
||||
}
|
||||
return err;
|
||||
|
||||
return errcode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -888,7 +888,7 @@ int main(int argc, char *argv[])
|
|||
char *script_name;
|
||||
char *path_info;
|
||||
char *path_translated;
|
||||
int err = 0;
|
||||
int errcode = 0;
|
||||
|
||||
/* Default formats. */
|
||||
|
||||
|
|
@ -930,14 +930,14 @@ int main(int argc, char *argv[])
|
|||
if (!path_translated)
|
||||
{
|
||||
internal_error("Couldn't get PATH_TRANSLATED environment variable.");
|
||||
err = 3;
|
||||
errcode = 3;
|
||||
goto errout_with_g_url;
|
||||
}
|
||||
|
||||
if (!check_filename(path_translated))
|
||||
{
|
||||
not_permitted("initial", "PATH_TRANSLATED", path_translated);
|
||||
err = 4;
|
||||
errcode = 4;
|
||||
goto errout_with_g_url;
|
||||
}
|
||||
|
||||
|
|
@ -947,7 +947,7 @@ int main(int argc, char *argv[])
|
|||
if (!instream)
|
||||
{
|
||||
not_found(path_translated);
|
||||
err = 5;
|
||||
errcode = 5;
|
||||
goto errout_with_g_url;
|
||||
}
|
||||
|
||||
|
|
@ -959,5 +959,5 @@ int main(int argc, char *argv[])
|
|||
|
||||
errout_with_g_url:
|
||||
free(g_url);
|
||||
return err;
|
||||
return errcode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -707,7 +707,7 @@ static int cgi_child(int argc, char **argv)
|
|||
int nbytes;
|
||||
int fd;
|
||||
int ret;
|
||||
int err = 1;
|
||||
int errcode = 1;
|
||||
|
||||
/* Use low-level debug out (because the low-level output may survive closing
|
||||
* all file descriptors
|
||||
|
|
@ -954,7 +954,7 @@ static int cgi_child(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
while (!outdone);
|
||||
err = 0;
|
||||
errcode = 0;
|
||||
|
||||
/* Get rid of watch structures */
|
||||
|
||||
|
|
@ -977,15 +977,16 @@ errout_with_cgiconn:
|
|||
httpd_free(cc);
|
||||
|
||||
errout:
|
||||
nllinfo("Return %d\n", err);
|
||||
if (err != 0)
|
||||
nllinfo("Return %d\n", errcode);
|
||||
if (errcode != 0)
|
||||
{
|
||||
INTERNALERROR("errout");
|
||||
httpd_send_err(hc, 500, err500title, "", err500form, hc->encodedurl);
|
||||
httpd_write_response(hc);
|
||||
cgi_semgive();
|
||||
}
|
||||
return err;
|
||||
|
||||
return errcode;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue