check return value of system call

This commit is contained in:
wbaumann 2010-11-07 11:08:32 +00:00
parent eb3f3839d4
commit 3a9a59db12
2 changed files with 4 additions and 5 deletions

View File

@ -167,8 +167,7 @@ init_coda(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata)
++minor;
}

if (*dev <= 0) {
system("/sbin/modprobe coda &>/dev/null");
if (*dev <= 0 && system("/sbin/modprobe coda &>/dev/null") == 0) {
minor = 0;
while (*dev <= 0 && minor < MAX_CODADEVS) {
char *path;
@ -223,8 +222,7 @@ init_fuse(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata,
abort();

*dev = open(path, O_RDWR | O_NONBLOCK);
if (*dev <= 0) {
system("/sbin/modprobe fuse &>/dev/null");
if (*dev <= 0 && system("/sbin/modprobe fuse &>/dev/null") == 0) {
*dev = open(path, O_RDWR | O_NONBLOCK);
}
if (*dev <= 0) {

View File

@ -72,6 +72,7 @@
#include <ne_utils.h>

#include "defaults.h"
#include "../gl/canonicalize.h"
#include "mount_davfs.h"
#include "kernel_interface.h"
#include "cache.h"
@ -528,7 +529,7 @@ check_dirs(dav_args *args)
char *template = ne_concat(DAV_DATA_DIR, "/", DAV_CONFIG, NULL);
char *command = ne_concat("cp ", template, " ", file_name,
NULL);
system(command);
if (system(command) != 0);
free(command);
free(template);
}