-$Id: CHANGES,v 1.315 2010/06/11 09:57:31 stelian Exp $
+$Id: CHANGES,v 1.316 2010/06/11 11:19:17 stelian Exp $
Changes between versions 0.4b42 and 0.4b43 (released ?????????????)
===================================================================
12. Extract dumped UNIX sockets instead of ignoring them.
(Sourceforge bug #3007216).
+13. Compiler warning fixes (mainly warn_unused_result ones).
+
Changes between versions 0.4b41 and 0.4b42 (released June 18, 2009)
===================================================================
#ifndef lint
static const char rcsid[] =
- "$Id: dumprmt.c,v 1.29 2006/03/13 10:33:44 stelian Exp $";
+ "$Id: dumprmt.c,v 1.30 2010/06/11 11:19:17 stelian Exp $";
#endif /* not lint */
#include <config.h>
char line[30];
(void)snprintf(line, sizeof (line), "W%ld\n", (long)count);
- write(tormtape, line, strlen(line));
- write(tormtape, buf, count);
+ if (write(tormtape, line, strlen(line)) != strlen(line))
+ return -1;
+ if (write(tormtape, buf, count) != count)
+ return -1;
return (rmtreply("write"));
}
#ifndef lint
static const char rcsid[] =
- "$Id: dirs.c,v 1.35 2008/04/17 15:16:47 stelian Exp $";
+ "$Id: dirs.c,v 1.36 2010/06/11 11:19:17 stelian Exp $";
#endif /* not lint */
#include <config.h>
if (dirloc + dp->d_reclen > DIRBLKSIZ) {
((struct direct *)(dirbuf + prev))->d_reclen =
DIRBLKSIZ - prev;
- if ( fwrite(dirbuf, 1, DIRBLKSIZ, df) != DIRBLKSIZ )
+ if ( fwrite(dirbuf, DIRBLKSIZ, 1, df) != 1 )
err(1,"cannot write to file %s", dirfile);
dirloc = 0;
}
clearerr(mf);
for (;;) {
char xattr[XATTR_MAXSIZE];
- (void) fread((char *)&node, 1, sizeof(struct modeinfo), mf);
- if (feof(mf))
- break;
- if (node.xattr) {
- (void) fread(xattr, 1, XATTR_MAXSIZE, mf);
+ if (fread((char *)&node, sizeof(struct modeinfo), 1, mf) != 1) {
if (feof(mf))
break;
+ err(1, "fread");
+ }
+ if (node.xattr) {
+ if (fread(xattr, XATTR_MAXSIZE, 1, mf) != 1) {
+ if (feof(mf))
+ break;
+ err(1, "fread");
+ }
}
ep = lookupino(node.ino);
if (command == 'i' || command == 'x') {
panic("cannot find directory inode %d\n", node.ino);
} else {
cp = myname(ep);
- (void) chown(cp, node.uid, node.gid);
+ if (chown(cp, node.uid, node.gid) < 0)
+ warn("chown");
(void) chmod(cp, node.mode);
utimes(cp, node.timep);
if (node.xattr)
clearerr(mf);
for (;;) {
char xattr[XATTR_MAXSIZE];
- (void) fread((char *)&node, 1, sizeof(struct modeinfo), mf);
- if (feof(mf))
- break;
- if (node.xattr) {
- (void) fread(xattr, 1, XATTR_MAXSIZE, mf);
+ if (fread((char *)&node, sizeof(struct modeinfo), 1, mf) != 1) {
if (feof(mf))
break;
+ err(1, "fread");
+ }
+ if (node.xattr) {
+ if (fread(xattr, XATTR_MAXSIZE, 1, mf) != 1) {
+ if (feof(mf))
+ break;
+ err(1, "fread");
+ }
}
ep = lookupino(node.ino);
if (ep == NULL) {
node.uid = dip->di_uid;
node.gid = dip->di_gid;
node.xattr = xattr ? 1 : 0;
- if ( fwrite((char *)&node, 1, sizeof(struct modeinfo), mf) != sizeof(struct modeinfo) )
+ if ( fwrite((char *)&node, sizeof(struct modeinfo), 1, mf) != 1 )
err(1,"cannot write to file %s", modefile);
if (xattr)
- if ( fwrite(xattr, 1, XATTR_MAXSIZE, mf) != XATTR_MAXSIZE)
+ if ( fwrite(xattr, XATTR_MAXSIZE, 1, mf) != 1 )
err(1,"cannot write to file %s", modefile);
}
#ifndef lint
static const char rcsid[] =
- "$Id: symtab.c,v 1.27 2005/07/07 09:16:08 stelian Exp $";
+ "$Id: symtab.c,v 1.28 2010/06/11 11:19:17 stelian Exp $";
#endif /* not lint */
/*
for (i = WINO; i <= maxino; i++) {
for (ep = lookupino(i); ep != NULL; ep = ep->e_links) {
ep->e_index = mynum++;
- (void) fwrite(ep->e_name, sizeof(char),
- (int)allocsize(ep->e_namlen), fd);
+ (void) fwrite(ep->e_name, (int)allocsize(ep->e_namlen),
+ sizeof(char), fd);
}
}
/*
if (temphash[j])
temphash[j] = (struct entry *)ep->e_entries[j]->e_index;
}
- fwrite(temphash, dirhash_size, sizeof(struct entry *), fd);
+ fwrite(temphash, sizeof(struct entry *), dirhash_size, fd);
}
}
}
#ifndef lint
static const char rcsid[] =
- "$Id: tape.c,v 1.98 2010/06/11 09:57:31 stelian Exp $";
+ "$Id: tape.c,v 1.99 2010/06/11 11:19:17 stelian Exp $";
#endif /* not lint */
#include <config.h>
do {
fprintf(stderr, "Specify next volume # (none if no more volumes): ");
(void) fflush(stderr);
- (void) fgets(buf, TP_BSIZE, terminal);
+ if (!fgets(buf, TP_BSIZE, terminal))
+ break;
} while (!feof(terminal) && buf[0] == '\n');
if (feof(terminal))
exit(1);
fprintf(stderr, "otherwise enter tape name (default: %s) ", magtape);
#endif
(void) fflush(stderr);
- (void) fgets(buf, TP_BSIZE, terminal);
+ if (fgets(buf, TP_BSIZE, terminal))
+ exit(1);
if (feof(terminal))
exit(1);
if (!strcmp(buf, "none\n")) {
}
close(sk);
}
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
skipfile();
#ifdef HAVE_LCHOWN
- (void) lchown(name, luid, lgid);
+ if (lchown(name, luid, lgid) < 0)
+ warn("%s: lchown", name);
#endif
extractattr(name);
return (GOOD);
return (FAIL);
}
}
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
return (FAIL);
}
}
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
}
else
skipfile();
- (void) chown(name, luid, lgid);
- (void) chmod(name, mode);
+ if (chown(name, luid, lgid) < 0)
+ warn("%s: chown", name);
+ if (chmod(name, mode) < 0)
+ warn("%s: chmod", name);
extractattr(name);
utimes(name, timep);
if (flags)
/* and add the resource data from tape */
getfile(xtrfile, xtrskip);
- (void) fchown(ofile, uid, gid);
- (void) fchmod(ofile, mode);
+ if (fchown(ofile, uid, gid) < 0)
+ warn("%s: fchown", name);
+ if (fchmod(ofile, mode) < 0)
+ warn("%s: fchmod", name);
(void) close(ofile);
utimes(oFileRsrc, timep);
(void) lsetflags(oFileRsrc, flags);
last_write_was_hole = 1;
}
if (last_write_was_hole) {
- FTRUNCATE(ofile, origsize);
+ if (FTRUNCATE(ofile, origsize) < 0)
+ warn("%s: ftruncate", curfile.name);
}
if (!readingmaps)
findinode(&spcl);
}
if (reason) {
if (lengtherr)
- fprintf(stderr, "%s compressed block: %d expected: %u\n",
- lengtherr, readsize, tpbin->length + PREFIXSIZE);
+ fprintf(stderr, "%s compressed block: %d expected: %lu\n",
+ lengtherr, readsize, (unsigned long)tpbin->length + PREFIXSIZE);
fprintf(stderr, "decompression error, block %ld: %s\n",
tpblksread+1, reason);
if (!cresult)
#ifndef lint
static const char rcsid[] =
- "$Id: utilities.c,v 1.29 2005/07/07 09:16:08 stelian Exp $";
+ "$Id: utilities.c,v 1.30 2010/06/11 11:19:17 stelian Exp $";
#endif /* not lint */
#include <config.h>
return;
if (reply("abort") == GOOD) {
if (reply("dump core") == GOOD) {
- fchdir(wdfd);
+ if (fchdir(wdfd) < 0)
+ warn("fchdir");
abort();
}
exit(1);
#ifndef lint
static const char rcsid[] =
- "$Id: xattr.c,v 1.6 2010/03/08 10:40:52 stelian Exp $";
+ "$Id: xattr.c,v 1.7 2010/06/11 11:19:17 stelian Exp $";
#endif /* not lint */
#include <config.h>
#define EXT2_XATTR_PAD_BITS 2
#define EXT2_XATTR_PAD (1<<EXT2_XATTR_PAD_BITS)
#define EXT2_XATTR_ROUND (EXT2_XATTR_PAD-1)
+#ifndef EXT2_XATTR_LEN
#define EXT2_XATTR_LEN(name_len) \
(((name_len) + EXT2_XATTR_ROUND + \
sizeof(struct ext2_xattr_entry)) & ~EXT2_XATTR_ROUND)
+#endif
#define EXT2_XATTR_NEXT(entry) \
( (struct ext2_xattr_entry *)( \
(char *)(entry) + EXT2_XATTR_LEN((entry)->e_name_len)) )
if (!buffer)
return real_size;
if (real_size > size) {
- fprintf(stderr, "ACL: not enough space to convert (%d %d)\n", real_size, size);
+ fprintf(stderr, "ACL: not enough space to convert (%d %d)\n", real_size, (int)size);
return -1;
}
valuesz = strlen(con) + 1;
valuef[0] = 0;
- strncat(valuef, con, sizeof valuef);
+ strncat(valuef, con, sizeof(valuef) - 1);
freecon(con);
}
else {
if (!transselinuxarg)
err = security_canonicalize_context(value, &con);
else {
- strncat(value, transselinuxarg, sizeof value);
+ strncat(value, transselinuxarg, sizeof(value) - 1);
err = security_canonicalize_context_raw(value, &con);
}
size = strlen(con) + 1;
value[0] = 0;
- strncat(value, con, sizeof value);
+ strncat(value, con, sizeof(value) - 1);
freecon(con);
}
#endif
#include <stdlib.h>
#include <stdio.h>
#include <syslog.h>
+#include <string.h>
#include <strings.h>
#include <errno.h>
#include <openssl/evp.h>
return NULL;
}
buf[0] = '\0';
- fgets(buf, sizeof buf, fp);
+ if (!fgets(buf, sizeof buf, fp)) {
+ syslog(LOG_ERR, "Error reading key file %s: %m", keyfile);
+ return NULL;
+ }
fclose(fp);
i = strlen(buf);
if ((i > 0) &&
#ifndef lint
static const char rcsid[] =
- "$Id: rmt.c,v 1.28 2003/11/22 16:52:16 stelian Exp $";
+ "$Id: rmt.c,v 1.29 2010/06/11 11:19:18 stelian Exp $";
#endif /* not linux */
/*
cp = record;
#endif
(void)sprintf(resp, "A%lld\n", (long long)rval);
- (void)write(1, resp, strlen(resp));
- (void)write(1, cp, rval);
+ if (write(1, resp, strlen(resp)) != strlen(resp))
+ goto ioerror;
+ if (write(1, cp, rval) != rval)
+ goto ioerror;
block += n >> 10;
goto top;
mtget.mt_fileno = swaplong(mtget.mt_fileno);
mtget.mt_blkno = swaplong(mtget.mt_blkno);
(void)sprintf(resp, "A%lld\n", (long long)rval);
- (void)write(1, resp, strlen(resp));
- (void)write(1, (char *)&mtget, sizeof (mtget));
+ if (write(1, resp, strlen(resp)) != strlen(resp))
+ goto ioerror;
+ if (write(1, (char *)&mtget, sizeof (mtget)) != sizeof(mtget))
+ goto ioerror;
} else {
rval = sizeof (mtget);
(void)sprintf(resp, "A%lld\n", (long long)rval);
- (void)write(1, resp, strlen(resp));
- (void)write(1, (char *)&mtget, sizeof (mtget));
+ if (write(1, resp, strlen(resp)) != strlen(resp))
+ goto ioerror;
+ if (write(1, (char *)&mtget, sizeof (mtget)) != sizeof(mtget))
+ goto ioerror;
}
goto top;
}
respond:
DEBUG1("rmtd: A %lld\n", (long long)rval);
(void)sprintf(resp, "A%lld\n", (long long)rval);
- (void)write(1, resp, strlen(resp));
+ if (write(1, resp, strlen(resp)) != strlen(resp))
+ goto ioerror;
goto top;
ioerror:
error(errno);
DEBUG2("rmtd: E %d (%s)\n", num, strerror(num));
(void)snprintf(resp, sizeof(resp), "E%d\n%s\n", num, strerror(num));
- (void)write(1, resp, strlen(resp));
+ if (write(1, resp, strlen(resp)) != strlen(resp))
+ DEBUG("rmtd: write error\n");
}
static unsigned long