1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

C code bug fixes

- fix to buildin.c to prevent compiler from optimizing it out
- fix to realpath.c to handle case where 'path' is NULL

- fix to emacs.c (I think from dgk)

- fix to file.c (I think from gsf)
- fix to tail.c (I think from gsf)

- fix to code setting the malloc init hook (for vmalloc)

- changed memcpy to memmove in several places in sfio because src and dst
  might overlap

- fixes to macros like FILE_defined to fix header file issues
- fixes to expr.h to handle macro definition issue
This commit is contained in:
Lefteris Koutsofios 2020-02-12 13:09:47 -05:00
parent 0b36868c8c
commit e8b3274a65
17 changed files with 62 additions and 36 deletions

View file

@ -25,3 +25,8 @@
*/
#include <cmd.h>
// @lkoutsofios added to prevent this file from being optimized out
int _do_not_opt_out (void) {
sfprintf (sfstderr, "unreachable");
}

View file

@ -1007,7 +1007,7 @@ static int escape(register Emacs_t* ep,register genchar *out,int count)
else if(i=='=' || (i=='\\' && out[cur-1]=='/'))
{
draw(ep,REFRESH);
if(count>0)
if(count>0 || i=='\\')
ep->ed->e_tabcount=0;
else
{

View file

@ -1183,14 +1183,19 @@ setfile(register Archive_t* ap, register File_t* f)
int m;
struct stat st;
if (lchmod(f->name, f->perm & state.modemask))
error(1, "%s: cannot chmod to %s", f->name, fmtmode(f->perm & state.modemask, 0) + 1);
else if (m = f->perm & (S_ISUID|S_ISGID|S_ISVTX))
if (lstat(f->name, &st))
error(1, "%s: not found", f->name);
else if ((f->perm ^ st.st_mode) & state.modemask & (S_ISUID|S_ISGID|S_ISVTX|S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH))
{
if (lstat(f->name, &st))
error(1, "%s: not found", f->name);
else if (m ^= (st.st_mode & (S_ISUID|S_ISGID|S_ISVTX)))
error(1, "%s: mode %s not set", f->name, fmtmode(m, 0) + 1);
if (lchmod(f->name, f->perm & state.modemask))
error(1, "%s: cannot chmod to %s", f->name, fmtmode(f->perm & state.modemask, 0) + 1);
else if (m = f->perm & (S_ISUID|S_ISGID|S_ISVTX))
{
if (lstat(f->name, &st))
error(1, "%s: not found", f->name);
else if (m ^= (st.st_mode & (S_ISUID|S_ISGID|S_ISVTX)))
error(1, "%s: mode %s not set", f->name, fmtmode(m, 0) + 1);
}
}
}
#endif