lundi 28 septembre 2020

zip command issue on linux

I have a zip command issue on Linux.

  1. From command prompt:

    zip -r /../../../tst.zip /../../../tst/json
    creates tst.zip file.

    unzip tst.zip is successful.

  2. With in c++ code:

    char zipcommand[sqglobal::MAX_SQ_FILE_PATH_LENGTH]={0};
    sprintf (zipcommand, "zip -r %s %s", "/../../../tst.zip", 
                                         "/../../../tst/json");
    system(zipcommand);
    

from command prompt, unzipping the zip file generated by code fails.

[root@localhost bin]# unzip SoftwareInventory.zip
Archive:  SoftwareInventory.zip
file #1:  bad zipfile offset (local header sig):  0
[root@localhost bin]#

The size of json file is 1260 Bytes. zip file size is 522 bytes.

Why unzip fails? what the error implies?

Aucun commentaire:

Enregistrer un commentaire