diff --git a/src/archwriter.c b/src/archwriter.c index b9a8d55..399c0f5 100644 --- a/src/archwriter.c +++ b/src/archwriter.c @@ -189,12 +189,12 @@ int archwriter_write_buffer(carchwriter *ai, struct s_writebuf *wb) assert(ai); assert(wb); - - if (wb->size <=0) + + if (wb->size == 0) { errprintf("wb->size=%ld\n", (long)wb->size); return -1; } - + if ((lres=write(ai->archfd, (char*)wb->data, (long)wb->size))!=(long)wb->size) { errprintf("write(size=%ld) returned %ld\n", (long)wb->size, (long)lres); diff --git a/src/common.c b/src/common.c index 9efa4e4..eef45c6 100644 --- a/src/common.c +++ b/src/common.c @@ -397,9 +397,9 @@ int exec_command(char *command, int cmdbufsize, int *exitst, char *stdoutbuf, in // read the remaining data in the pipes if ((stdoutbuf!=NULL) && (outpos+1 < stdoutsize)) - res=read(mystdout, stdoutbuf+outpos, stdoutsize-outpos-1); + read(mystdout, stdoutbuf+outpos, stdoutsize-outpos-1); if ((stderrbuf!=NULL) && (errpos+1 < stderrsize)) - res=read(mystderr, stderrbuf+errpos, stderrsize-errpos-1); + read(mystderr, stderrbuf+errpos, stderrsize-errpos-1); msgprintf(MSG_VERB1, "command [%s] returned %d\n", command, WEXITSTATUS(status)); if (exitst) @@ -616,4 +616,3 @@ int get_path_to_volume(char *newvolbuf, int bufsize, char *basepath, long curvol return 0; } - diff --git a/src/fs_reiser4.c b/src/fs_reiser4.c index 42993d5..8c1cb61 100644 --- a/src/fs_reiser4.c +++ b/src/fs_reiser4.c @@ -126,8 +126,8 @@ int reiser4_getinfo(cdico *d, char *devname) temp16=le16_to_cpu(sb.blocksize); if (temp16!=4096) { ret=-5; - goto reiser4_get_specific_close; errprintf("invalid reiser4 block-size: %ld, it should be 4096\n", (long)temp16); + goto reiser4_get_specific_close; } else { dico_add_u64(d, 0, FSYSHEADKEY_FSREISER4BLOCKSIZE, temp16); diff --git a/src/fsarchiver.c b/src/fsarchiver.c index 7c414f1..3f3b018 100644 --- a/src/fsarchiver.c +++ b/src/fsarchiver.c @@ -46,13 +46,17 @@ char *valid_magic[]={FSA_MAGIC_MAIN, FSA_MAGIC_VOLH, FSA_MAGIC_VOLF, void usage(char *progname, bool examples) { - int lzo=false, lzma=false; - + int lzo, lzma; + #ifdef OPTION_LZO_SUPPORT lzo=true; +#else + lzo=false; #endif // OPTION_LZO_SUPPORT #ifdef OPTION_LZMA_SUPPORT lzma=true; +#else + lzma=false; #endif // OPTION_LZMA_SUPPORT msgprintf(MSG_FORCE, "====> fsarchiver version %s (%s) - http://www.fsarchiver.org <====\n", FSA_VERSION, FSA_RELDATE); diff --git a/src/oper_restore.c b/src/oper_restore.c index 0c8fe3a..ef0a959 100644 --- a/src/oper_restore.c +++ b/src/oper_restore.c @@ -168,7 +168,7 @@ int convert_argv_to_strdicos(cstrdico *dicoargv[], int argc, char *cmdargv[]) int extractar_listing_print_file(cextractar *exar, int objtype, char *relpath) { char strprogress[256]; - u64 progress; + s64 progress; memset(strprogress, 0, sizeof(strprogress)); if (exar->cost_global>0) diff --git a/src/oper_save.c b/src/oper_save.c index 7d1838e..bc716cb 100644 --- a/src/oper_save.c +++ b/src/oper_save.c @@ -279,7 +279,7 @@ int createar_item_xattr(csavear *save, char *root, char *relpath, struct stat64 len=strlen(buffer+pos)+1; attrsize=lgetxattr(fullpath, buffer+pos, NULL, 0); msgprintf(MSG_VERB2, " xattr:file=[%s], attrid=%d, name=[%s], size=%ld\n", relpath, (int)attrcnt, buffer+pos, (long)attrsize); - if ((attrsize>0) && (attrsize>65535LL)) + if (attrsize>65535LL) { errprintf("file [%s] has an xattr [%s] with data too big (size=%ld, maxsize=64k)\n", relpath, buffer+pos, (long)attrsize); ret=-1; continue; // copy the next xattr @@ -311,7 +311,7 @@ int createar_item_xattr(csavear *save, char *root, char *relpath, struct stat64 free(valbuf); continue; // copy the next xattr } - else if (errno==ENOATTR) // if the attribute does not exist + else // errno==ENOATTR hence the attribute does not exist { msgprintf(MSG_VERB2, " xattr:lgetxattr-win(%s,%s)=-1: errno==ENOATTR\n", relpath, buffer+pos); free(valbuf); @@ -353,7 +353,7 @@ int createar_item_winattr(csavear *save, char *root, char *relpath, struct stat6 continue; // ignore the current xattr } msgprintf(MSG_VERB2, " winattr:file=[%s], attrcnt=%d, name=[%s], size=%ld\n", relpath, (int)attrcnt, winattr[i], (long)attrsize); - if ((attrsize>0) && (attrsize>65535LL)) + if (attrsize>65535LL) { errprintf("file [%s] has an xattr [%s] with data size=%ld too big (max xattr size is 65535)\n", relpath, winattr[i], (long)attrsize); ret=-1; @@ -384,15 +384,11 @@ int createar_item_winattr(csavear *save, char *root, char *relpath, struct stat6 free(valbuf); continue; // ignore the current xattr } - else if (errno==ENOATTR) // if the attribute does not exist + else // errno==ENOATTR hence the attribute does not exist { msgprintf(MSG_VERB2, " winattr:lgetxattr-win(%s,%s)=-1: errno==ENOATTR\n", relpath, winattr[i]); free(valbuf); } - else - { - free(valbuf); - } } return ret; @@ -581,7 +577,7 @@ int createar_save_file(csavear *save, char *root, char *relpath, struct stat64 * cdico *dicoattr; int attrerrors=0; u64 filecost; - u64 progress; + s64 progress; int objtype; int res; diff --git a/src/queue.c b/src/queue.c index 6b2d9b8..a1bca70 100644 --- a/src/queue.c +++ b/src/queue.c @@ -509,8 +509,8 @@ s64 queue_dequeue_block(cqueue *q, cblockinfo *blkinfo) return FSAERR_ENDOFFILE; } - // should not happen since queuelocked_is_first_block_ready means there is at least one block in the queue - assert((cur=q->head)!=NULL); + cur=q->head; + assert(cur!=NULL); // queuelocked_is_first_block_ready means there is at least one block in the queue // test the first item if ((cur->type==QITEM_TYPE_BLOCK) && (cur->status==QITEM_STATUS_DONE)) @@ -581,8 +581,8 @@ s64 queue_dequeue_header_internal(cqueue *q, cheadinfo *headinfo) return FSAERR_ENDOFFILE; } - // should not happen since queuelocked_is_first_block_ready means there is at least one block in the queue - assert ((cur=q->head)!=NULL); + cur=q->head; + assert (cur!=NULL); // queuelocked_is_first_block_ready means there is at least one block in the queue // test the first item switch (cur->type) @@ -712,8 +712,8 @@ s64 queue_destroy_first_item(cqueue *q) return FSAERR_ENDOFFILE; } - // should not happen since queuelocked_is_first_block_ready means there is at least one block in the queue - assert((cur=q->head)!=NULL); + cur=q->head; + assert(cur!=NULL); // queuelocked_is_first_block_ready means there is at least one block in the queue switch (cur->type) { diff --git a/src/thread_comp.c b/src/thread_comp.c index 8827d0f..4b6bf15 100644 --- a/src/thread_comp.c +++ b/src/thread_comp.c @@ -127,7 +127,7 @@ int compress_block_generic(struct s_blockinfo *blkinfo) } if ((res=crypto_blowfish(blkinfo->blkcompsize, &cryptsize, (u8*)bufcomp, (u8*)bufcrypt, g_options.encryptpass, strlen((char*)g_options.encryptpass), 1))!=0) - { errprintf("crypt_block_blowfish() failed\n"); + { errprintf("crypt_block_blowfish() failed with res=%d\n", res); return -1; } free(bufcomp);