*/
setenv ("PATH", "/usr/bin:/bin", 1);
setenv ("SHELL", "/bin/sh", 1);
- setenv ("LANG", "C", 1);
+ setenv ("LC_ALL", "C", 1);
/* We document that umask defaults to 022 (it should be this anyway). */
umask (022);
exit (1);
}
- (void) xwrite (sock, buf, xdr_getpos (&xdr));
+ if (xwrite (sock, buf, xdr_getpos (&xdr)) == -1)
+ exit (1);
xdr_destroy (&xdr);
}
int
-xwrite (int sock, const void *buf, size_t len)
+xwrite (int sock, const void *v_buf, size_t len)
{
int r;
+ const char *buf = v_buf;
while (len > 0) {
r = write (sock, buf, len);
}
int
-xread (int sock, void *buf, size_t len)
+xread (int sock, void *v_buf, size_t len)
{
int r;
+ char *buf = v_buf;
while (len > 0) {
r = read (sock, buf, len);
}
int
-count_strings (char * const* const argv)
+count_strings (char *const *argv)
{
int argc;
command (char **stdoutput, char **stderror, const char *name, ...)
{
va_list args;
- char **argv, **p;
+ const char **argv;
char *s;
int i, r;
va_start (args, name);
while ((s = va_arg (args, char *)) != NULL) {
- p = realloc (argv, sizeof (char *) * (++i));
+ const char **p = realloc (argv, sizeof (char *) * (++i));
if (p == NULL) {
perror ("realloc");
free (argv);
va_end (args);
- r = commandv (stdoutput, stderror, argv);
+ r = commandv (stdoutput, stderror, (char **) argv);
/* NB: Mustn't free the strings which are on the stack. */
free (argv);
commandr (char **stdoutput, char **stderror, const char *name, ...)
{
va_list args;
- char **argv, **p;
+ const char **argv;
char *s;
int i, r;
va_start (args, name);
while ((s = va_arg (args, char *)) != NULL) {
- p = realloc (argv, sizeof (char *) * (++i));
+ const char **p = realloc (argv, sizeof (char *) * (++i));
if (p == NULL) {
perror ("realloc");
free (argv);
/* Same as 'command', but passing an argv. */
int
-commandv (char **stdoutput, char **stderror, char * const* const argv)
+commandv (char **stdoutput, char **stderror, char *const *argv)
{
int r;
- r = commandrv (stdoutput, stderror, argv);
+ r = commandrv (stdoutput, stderror, (void *) argv);
if (r == 0)
return 0;
else
}
int
-commandrv (char **stdoutput, char **stderror, char * const* const argv)
+commandrv (char **stdoutput, char **stderror, char const* const *argv)
{
int so_size = 0, se_size = 0;
int so_fd[2], se_fd[2];
close (so_fd[1]);
close (se_fd[1]);
- execvp (argv[0], argv);
+ execvp (argv[0], (void *) argv);
perror (argv[0]);
_exit (1);
}
*/
static int
print_shell_quote (FILE *stream,
- const struct printf_info *info,
+ const struct printf_info *info ATTRIBUTE_UNUSED,
const void *const *args)
{
#define SAFE(c) (isalnum((c)) || \
const struct printf_info *info,
const void *const *args)
{
-#define SAFE(c) (isalnum((c)) || \
- (c) == '/' || (c) == '-' || (c) == '_' || (c) == '.')
fputs (sysroot, stream);
return sysroot_len + print_shell_quote (stream, info, args);
}
#ifdef HAVE_REGISTER_PRINTF_SPECIFIER
static int
-print_arginfo (const struct printf_info *info,
+print_arginfo (const struct printf_info *info ATTRIBUTE_UNUSED,
size_t n, int *argtypes, int *size)
{
if (n > 0) {
#endif
/* Perform device name translation. Don't call this directly -
- * use the IS_DEVICE macro.
+ * use the RESOLVE_DEVICE macro.
*
* See guestfs(3) for the algorithm.
*