From e60683a0d553b6488c564863f4e48954944fb0f8 Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Fri, 22 Feb 2013 20:55:50 -0500 Subject: use libblkid to get filesystem type we can now use libblkid to detect exfat --- libblkid/exec_shell.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 libblkid/exec_shell.c (limited to 'libblkid/exec_shell.c') diff --git a/libblkid/exec_shell.c b/libblkid/exec_shell.c new file mode 100644 index 000000000..95620cd4d --- /dev/null +++ b/libblkid/exec_shell.c @@ -0,0 +1,27 @@ +#include +#include +#include +#include + +#include "nls.h" +#include "c.h" +#include "xalloc.h" + +#include "exec_shell.h" + +#define DEFAULT_SHELL "/bin/sh" + +void __attribute__((__noreturn__)) exec_shell(void) { + const char *shell = getenv("SHELL"), *shell_basename; + char *arg0; + if (!shell) + shell = DEFAULT_SHELL; + + shell_basename = basename(shell); + arg0 = xmalloc(strlen(shell_basename) + 2); + arg0[0] = '-'; + strcpy(arg0 + 1, shell_basename); + + execl(shell, arg0, NULL); + err(EXIT_FAILURE, _("failed to execute %s"), shell); +} -- cgit v1.2.3