Fix new reported compliant issues

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit is contained in:
Otavio Pontes
2019-10-10 09:08:57 -07:00
parent 4682777430
commit 0f90dbaf07
6 changed files with 31 additions and 29 deletions
+3 -1
View File
@@ -62,12 +62,14 @@ install:
- pushd libarchive-3.3.1 && autoreconf -fi && ./configure --prefix=/usr && make -j48 && sudo make install && popd
- sudo apt-get install python3-docutils
- sudo apt-get install realpath
- sudo apt-get install clang-format-6.0
- sudo apt-get install shellcheck
- sudo apt-get install doxygen
- sudo pip install coverxygen
- sudo ln -s /usr/share/docutils/scripts/python3/rst2man /usr/bin/rst2man.py
- git fetch origin master:refs/remotes/origin/master #Download origin/master for shelcheck
- sudo add-apt-repository "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main"
- sudo apt-get update
- sudo apt-get install -y --allow-unauthenticated clang-format-9
# Ubuntu's default umask is 0002, but this break's swupd hash calculations.
before_script:
+5 -5
View File
@@ -88,11 +88,11 @@ struct swupd_curl_parallel_handle {
CURLM *mcurl; /* Curl handle */
struct list *failed; /* List of failed downloads */
struct hashmap *curl_hashmap; /* Hashmap mentioned above */
struct hashmap *curl_hashmap; /* Hashmap mentioned above */
struct tp *thpool; /* Pointer to the threadpool */
swupd_curl_success_cb success_cb; /* Callback to success function */
swupd_curl_error_cb error_cb; /* Callback to error function */
swupd_curl_free_cb free_cb; /* Callback to free user data */
swupd_curl_error_cb error_cb; /* Callback to error function */
swupd_curl_free_cb free_cb; /* Callback to free user data */
swupd_curl_progress_cb progress_cb; /* Callback to report download progress */
void *data;
};
@@ -102,7 +102,7 @@ struct swupd_curl_parallel_handle {
*/
struct multi_curl_file {
struct curl_file file; /* Curl file information */
enum download_status status; /* status of last download try */
enum download_status status; /* status of last download try */
char retries; /* Number of retried performed so far */
CURL *curl; /* curl handle if downloading */
char *url; /* The url to be downloaded from */
@@ -110,7 +110,7 @@ struct multi_curl_file {
const char *hash; /* Unique identifier of this file. */
swupd_curl_success_cb callback; /* Holds original success callback to be wrapped */
void *data; /* user's data */
void *data; /* user's data */
bool cb_retval; /* return value from callback */
struct file_progress *progress;
};
+2 -2
View File
@@ -43,7 +43,7 @@
#include "swupd.h"
static struct filerecord *F; /* Array of filerecords */
static int nF = 0; /* Number of filerecords */
static int nF = 0; /* Number of filerecords */
static const regex_t *path_whitelist;
static int path_prefix_len;
@@ -74,7 +74,7 @@ static int record_filename(const char *name, const struct stat *stat __attribute
}
char *savedname = strdup_or_die(relname); /* Only store name relative to top of area */
F = realloc(F, (nF + 1) * sizeof(*F)); /* TODO, check realloc is smart, so don't need to double myself */
F = realloc(F, (nF + 1) * sizeof(*F)); /* TODO, check realloc is smart, so don't need to double myself */
ON_NULL_ABORT(F);
F[nF].filename = savedname;
+1 -1
View File
@@ -28,7 +28,7 @@ struct manifest {
char *component;
// File list
struct list *files; /* struct file for files */
struct list *files; /* struct file for files */
struct list *manifests; /* struct file for possible manifests */
// Helper data
+19 -19
View File
@@ -12,39 +12,39 @@ enum swupd_code {
SWUPD_NO, /* 1 used by swupd to respond "No" in different situations:
- if used with check-update it means no update is available
- if used with autoupdate it means automatic updating is disabled */
SWUPD_REQUIRED_BUNDLE_ERROR, /* 2 a required bundle is missing or was attempted to be removed */
SWUPD_REQUIRED_BUNDLE_ERROR, /* 2 a required bundle is missing or was attempted to be removed */
SWUPD_INVALID_BUNDLE, /* 3 the specified bundle is invalid */
SWUPD_COULDNT_LOAD_MOM, /* 4 MoM cannot be loaded into memory (this could imply network issue) */
SWUPD_COULDNT_REMOVE_FILE, /* 5 couldn't delete a file which must be deleted */
SWUPD_COULDNT_RENAME_DIR, /* 6 couldn't rename a directory */
SWUPD_COULDNT_CREATE_FILE, /* 7 couldn't create a file */
SWUPD_COULDNT_REMOVE_FILE, /* 5 couldn't delete a file which must be deleted */
SWUPD_COULDNT_RENAME_DIR, /* 6 couldn't rename a directory */
SWUPD_COULDNT_CREATE_FILE, /* 7 couldn't create a file */
SWUPD_RECURSE_MANIFEST, /* 8 error while recursing a manifest */
SWUPD_LOCK_FILE_FAILED, /* 9 cannot get the lock */
SWUPD_COULDNT_RENAME_FILE, /* 10 couldn't rename a file */
SWUPD_COULDNT_RENAME_FILE, /* 10 couldn't rename a file */
SWUPD_CURL_INIT_FAILED, /* 11 cannot initialize curl agent */
SWUPD_INIT_GLOBALS_FAILED, /* 12 cannot initialize globals */
SWUPD_BUNDLE_NOT_TRACKED, /* 13 bundle is not tracked on the system */
SWUPD_COULDNT_LOAD_MANIFEST, /* 14 cannot load manifest into memory */
SWUPD_INIT_GLOBALS_FAILED, /* 12 cannot initialize globals */
SWUPD_BUNDLE_NOT_TRACKED, /* 13 bundle is not tracked on the system */
SWUPD_COULDNT_LOAD_MANIFEST, /* 14 cannot load manifest into memory */
SWUPD_INVALID_OPTION, /* 15 invalid command option */
SWUPD_SERVER_CONNECTION_ERROR, /* 16 no network connection to swupd server */
SWUPD_COULDNT_DOWNLOAD_FILE, /* 17 file download problem */
SWUPD_COULDNT_UNTAR_FILE, /* 18 couldn't untar a file */
SWUPD_COULDNT_CREATE_DIR, /* 19 cannot create required directory */
SWUPD_CURRENT_VERSION_UNKNOWN, /* 20 cannot determine current OS version */
SWUPD_SERVER_CONNECTION_ERROR, /* 16 no network connection to swupd server */
SWUPD_COULDNT_DOWNLOAD_FILE, /* 17 file download problem */
SWUPD_COULDNT_UNTAR_FILE, /* 18 couldn't untar a file */
SWUPD_COULDNT_CREATE_DIR, /* 19 cannot create required directory */
SWUPD_CURRENT_VERSION_UNKNOWN, /* 20 cannot determine current OS version */
SWUPD_SIGNATURE_VERIFICATION_FAILED, /* 21 cannot initialize signature verification */
SWUPD_BAD_TIME, /* 22 system time is bad */
SWUPD_COULDNT_DOWNLOAD_PACK, /* 23 pack download failed */
SWUPD_COULDNT_DOWNLOAD_PACK, /* 23 pack download failed */
SWUPD_BAD_CERT, /* 24 unable to verify server SSL certificate */
SWUPD_DISK_SPACE_ERROR, /* 25 not enough disk space left (or it cannot be determined) */
SWUPD_PATH_NOT_IN_MANIFEST, /* 26 the required path is not in any manifest */
SWUPD_UNEXPECTED_CONDITION, /* 27 an unexpected condition was found */
SWUPD_PATH_NOT_IN_MANIFEST, /* 26 the required path is not in any manifest */
SWUPD_UNEXPECTED_CONDITION, /* 27 an unexpected condition was found */
SWUPD_SUBPROCESS_ERROR, /* 28 failure to execute another program in a subprocess */
SWUPD_COULDNT_LIST_DIR, /* 29 couldn't list the content of a directory */
SWUPD_COMPUTE_HASH_ERROR, /* 30 there was an error computing the hash of the specified file */
SWUPD_COMPUTE_HASH_ERROR, /* 30 there was an error computing the hash of the specified file */
SWUPD_TIME_UNKNOWN, /* 31 couldn't get current system time */
SWUPD_COULDNT_WRITE_FILE, /* 32 couldn't write to a file */
SWUPD_COULDNT_WRITE_FILE, /* 32 couldn't write to a file */
SWUPD_MIX_COLLISIONS, /* 33 collisions were found between mix and upstream */
SWUPD_OUT_OF_MEMORY_ERROR, /* 34 swupd ran out of memory */
SWUPD_OUT_OF_MEMORY_ERROR, /* 34 swupd ran out of memory */
SWUPD_VERIFY_FAILED, /* 35 verify could not fix/replace/delete one or more files */
SWUPD_INVALID_BINARY, /* 36 binary to be executed is missing or invalid */
+1 -1
View File
@@ -24,7 +24,7 @@ check_sort_makefile()
return "$status"
fi
run clang-format -i -style=file src/*.[ch] src/lib/*.[ch]
run clang-format-9 -i -style=file src/*.[ch] src/lib/*.[ch]
if [ "$status" -ne 0 ]; then
return "$status"
fi