aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2020-04-19 00:35:25 -0400
committerGitHub <noreply@github.com>2020-04-19 00:35:25 -0400
commit57c9489b28a481abc078ad3a2dd197079f9c414b (patch)
tree12cc1ea0186b242a82d87bc2f62142e5decefedb /src
parent59f7d29e2d707373ba1153337dca3279a2e3acc5 (diff)
parent8cdddbb0f1a8c6eb023cbe732e5701240a54ff3c (diff)
downloadspmc-57c9489b28a481abc078ad3a2dd197079f9c414b.tar.gz
Merge pull request #25 from jhunkeler/error-handler-etc
Error handler etc
Diffstat (limited to 'src')
-rw-r--r--src/spm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/spm.c b/src/spm.c
index e2e7a8f..bb58401 100644
--- a/src/spm.c
+++ b/src/spm.c
@@ -128,6 +128,13 @@ int main(int argc, char *argv[], char *arge[]) {
usage(program_name);
exit(1);
}
+
+ // Installing into the system's root is forbidden for obvious reasons
+ if (strcmp(arg_next, DIRSEPS) == 0) {
+ fprintf(stderr, "FATAL: refusing to operate on the system root directory\n");
+ exit(1);
+ }
+
strcpy(rootdir, arg_next);
i++;
}
@@ -236,7 +243,10 @@ int main(int argc, char *argv[], char *arge[]) {
if (RUNTIME_INSTALL) {
int status_install = 0;
if ((status_install = spm_do_install(rootfs, mf, packages)) == -1) {
- // failed to create temporary destination root
+ // general failure
+ if (spmerrno) {
+ spm_perror("Failed with reason");
+ }
exit(1);
} else if (status_install == -2) {
// user said no when asked to proceed