Coverity 1416282

This commit is contained in:
tg 2017-08-07 23:25:09 +00:00
parent a318b33ace
commit 23320b7a72
1 changed files with 6 additions and 5 deletions

View File

@ -27,7 +27,7 @@
#include <sys/file.h> #include <sys/file.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.165 2017/08/07 23:15:47 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.166 2017/08/07 23:25:09 tg Exp $");
Trap sigtraps[ksh_NSIG + 1]; Trap sigtraps[ksh_NSIG + 1];
static struct sigaction Sigact_ign; static struct sigaction Sigact_ign;
@ -724,12 +724,13 @@ hist_persist_back(int srcfd)
int rv = 0; int rv = 0;
#define MKSH_HS_BUFSIZ 4096 #define MKSH_HS_BUFSIZ 4096
if ((buf = malloc_osfunc(MKSH_HS_BUFSIZ)) == NULL) if ((tot = lseek(srcfd, (off_t)0, SEEK_END)) < 0 ||
lseek(srcfd, (off_t)0, SEEK_SET) < 0 ||
lseek(histfd, (off_t)0, SEEK_SET) < 0)
return (1); return (1);
tot = lseek(srcfd, (off_t)0, SEEK_END); if ((buf = malloc_osfunc(MKSH_HS_BUFSIZ)) == NULL)
lseek(srcfd, (off_t)0, SEEK_SET); return (1);
lseek(histfd, (off_t)0, SEEK_SET);
mis = tot; mis = tot;
while (mis > 0) { while (mis > 0) {