char *passwd;
char dmcrypt_setup_cmd[BUF_SIZE];
char err_buf[BUF_SIZE];
+ const char *err_str;
if (pkgid == NULL || loopback_device == NULL) {
_E("invalid argument");
free(passwd);
ret = system(dmcrypt_setup_cmd);
if (ret) {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
_E("Error setting up dmcrypt on app2sd file, error:%s, ret:%d",
- err_buf, ret);
+ err_str, ret);
return APP2EXT_ERROR_SETUP_DMCRYPT_DEVICE;
}
char dmcrypt_open_cmd[BUF_SIZE];
char dev_name[BUF_SIZE];
char buf[BUF_SIZE];
+ const char *err_str;
if (pkgid == NULL || loopback_device == NULL) {
_E("invalid argument");
ret = system(dmcrypt_open_cmd);
if (ret) {
- strerror_r(errno, buf, sizeof(buf));
- _E("error opening dmcrypt device, error: [%s]", buf);
+ err_str = strerror_r(errno, buf, sizeof(buf));
+ _E("error opening dmcrypt device, error: [%s]", err_str);
return APP2EXT_ERROR_OPEN_DMCRYPT_DEVICE;
}
char dev_node[BUF_SIZE];
char dmcrypt_close_cmd[BUF_SIZE];
char err_buf[BUF_SIZE];
+ const char *err_str;
char *t_dev_node;
if (pkgid == NULL) {
"/sbin/cryptsetup -q luksClose %s", dev_node);
ret = system(dmcrypt_close_cmd);
if (ret) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- _E("error closing dmcrypt on app2sd file: %s", err_buf);
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
+ _E("error closing dmcrypt on app2sd file: %s", err_str);
return APP2EXT_ERROR_CLOSE_DMCRYPT_DEVICE;
}
int ret;
FILE *fp;
char err_buf[1024];
+ const char *err_str;
const char *argv[] = { "/sbin/mkfs.ext4", device_path, NULL };
if (device_path == NULL) {
/* Format the filesystem [create a filesystem]*/
fp = fopen(device_path, "r+");
if (fp == NULL) {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
_E("unable to access (%s) error is (%d, %s)",
device_path, errno, err_buf);
return APP2EXT_ERROR_ACCESS_FILE;
ret = _xsystem(argv);
if (ret) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- _E("creating file system failed, error is (%s)", err_buf);
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
+ _E("creating file system failed, error is (%s)", err_str);
return APP2EXT_ERROR_CREATE_FS;
}
return ret;
char app_mmc_path[FILENAME_MAX];
char temp_path[FILENAME_MAX];
char err_buf[1024];
+ const char *err_str;
struct timespec time = {
.tv_sec = 0,
.tv_nsec = 1000 * 1000 * 200
snprintf(mountflags_str, sizeof(mountflags_str), "%u",
MS_MGC_VAL | MS_RDONLY | MS_NOSUID);
ret = _xsystem(argv_mount);
- if (ret < 0) {
+ if (ret) {
_E("read only mount failed, errono is (%d), "
"dev is (%s) path is (%s)",
- errno, dev, app_mmc_path);
+ ret, dev, app_mmc_path);
ret = APP2EXT_ERROR_MOUNT;
}
break;
snprintf(mountflags_str, sizeof(mountflags_str), "%u",
MS_MGC_VAL | MS_NOSUID);
ret = _xsystem(argv_mount);
- if (ret < 0) {
- _E("read write mount failed, errono is (%d)", errno);
+ if (ret) {
+ _E("read write mount failed, errno is (%d)", ret);
ret = APP2EXT_ERROR_MOUNT;
}
break;
snprintf(mountflags_str, sizeof(mountflags_str), "%u",
MS_MGC_VAL | MS_NOEXEC | MS_NOSUID);
ret = _xsystem(argv_mount);
- if (ret < 0) {
- _E("rwnx mount failed errono is (%d)", errno);
+ if (ret) {
+ _E("rwnx mount failed errno is (%d)", ret);
ret = APP2EXT_ERROR_MOUNT;
}
break;
MS_MGC_VAL | MS_RDONLY | MS_REMOUNT |
MS_NOSUID);
ret = _xsystem(argv_mount);
- if (ret < 0) {
- _E("read remount failed errono is (%d)", errno);
+ if (ret) {
+ _E("read remount failed errno is (%d)", ret);
ret = APP2EXT_ERROR_MOUNT;
}
break;
snprintf(mountflags_str, sizeof(mountflags_str), "%u",
MS_MGC_VAL | MS_REMOUNT | MS_NOSUID);
ret = _xsystem(argv_mount);
- strerror_r(errno, err_buf, sizeof(err_buf));
- if (ret < 0) {
- _E("read write remount failed errono(%d), errstr(%s)",
- errno, err_buf);
+ err_str = strerror_r(ret, err_buf, sizeof(err_buf));
+ if (ret) {
+ _E("read write remount failed errno(%d), errstr(%s)",
+ ret, err_str);
ret = APP2EXT_ERROR_MOUNT;
}
break;
int ret;
char app_mmc_path[FILENAME_MAX];
char err_buf[1024];
+ const char *err_str;
snprintf(app_mmc_path, sizeof(app_mmc_path), "%s/.mmc",
application_path);
ret = umount(app_mmc_path);
if (ret < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
_D("unable to umount the dir, ret(%d) error(%d, %s)",
- ret, errno, err_buf);
+ ret, errno, err_str);
}
return ret;
{
int ret;
char err_buf[1024];
+ const char *err_str;
ret = _app2sd_copy_dir(src_path, arch_path);
if (ret && ret != APP2EXT_ERROR_ACCESS_FILE) {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
_E("unable to copy from (%s) to (%s), err is (%s)",
- src_path, arch_path, err_buf);
+ src_path, arch_path, err_str);
return APP2EXT_ERROR_MOVE;
}
GList *list;
app2ext_dir_details *dir_detail;
char err_buf[1024];
+ const char *err_str;
ret = _app2sd_get_loopback_device_path(mmc_path, pkgid, uid,
loopback_device, sizeof(loopback_device));
if (ret == APP2EXT_ERROR_ACCESS_FILE) {
_E("unable to access (%s)", temp_dir_path);
} else {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf,
+ sizeof(err_buf));
_E("unable to copy from (%s) to (%s),"
" error is (%s)", temp_dir_path,
- app_mmc_path, err_buf);
+ app_mmc_path, err_str);
}
goto ERR;
}
int free_internal_mem;
unsigned long long temp = 0;
char err_buf[1024];
+ const char *err_str;
int mount_type;
ret = _app2sd_get_loopback_device_path(mmc_path, pkgid, uid,
if (ret == APP2EXT_ERROR_ACCESS_FILE) {
_E("unable to access (%s)", temp_dir_path);
} else {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf,
+ sizeof(err_buf));
_E("unable to copy from (%s) to (%s),"
"error is (%s)", temp_dir_path,
- app_archive_path, err_buf);
+ app_archive_path, err_str);
}
goto ERR;
}
if (ret == APP2EXT_ERROR_ACCESS_FILE) {
_E("unable to access (%s)", temp_dir_path);
} else {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf,
+ sizeof(err_buf));
_E("unable to copy from (%s) to (%s), "
"error is (%s)", temp_dir_path,
- application_path, err_buf);
+ application_path, err_str);
}
goto ERR;
}
*
*/
+#define _GNU_SOURCE
#include <dirent.h>
#include <glib.h>
#include <storage-internal.h>
int status;
pid_t pid;
char err_buf[1024];
+ const char *err_str;
pid = fork();
switch (pid) {
return -1;
case 0:
/* child */
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
if (execvp(argv[0], (char *const *)argv) < 0)
fprintf(stderr, "execvp failed %d....%s\n",
- errno, err_buf);
+ errno, err_str);
_exit(-1);
default:
/* parent */
char *ret_result;
int result;
char err_buf[1024];
+ const char *err_str;
if (pipe(my_pipe) < 0) {
fprintf(stderr, "Unable to create pipe\n");
close(0);
result = dup2(my_pipe[1], 1);
if (result < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- fprintf(stderr, "dup failed %d...%s\n", errno, err_buf);
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
+ fprintf(stderr, "dup failed %d...%s\n", errno, err_str);
_exit(-1);
}
result = dup2(my_pipe[1], 2);
if (result < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- fprintf(stderr, "dup failed %d...%s\n", errno, err_buf);
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
+ fprintf(stderr, "dup failed %d...%s\n", errno, err_str);
_exit(-1);
}
if (execvp(argv[0], (char *const *)argv) < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
fprintf(stderr, "execvp failed %d....%s\n",
- errno, err_buf);
+ errno, err_str);
}
_exit(-1);
default:
close(my_pipe[1]);
result = read(my_pipe[0], buf, sizeof(buf) - 1);
if (result < 0) {
- strerror_r(errno, err_buf, sizeof(err_buf));
- fprintf(stderr, "read failed %d..%s\n", errno, err_buf);
+ err_str = strerror_r(errno, err_buf, sizeof(err_buf));
+ fprintf(stderr, "read failed %d..%s\n", errno, err_str);
}
break;
}