X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=fish%2Falloc.c;h=a7d115a9cede750c512b3825e7d417c54e0ebad6;hb=881770900938595565036b9b191cfdf39ff0dc98;hp=8979acf451b7b3fa013f77f998f353ab7c9c59b3;hpb=612a358b8935381e5b8d706e4a77689cd316a18d;p=libguestfs.git diff --git a/fish/alloc.c b/fish/alloc.c index 8979acf..a7d115a 100644 --- a/fish/alloc.c +++ b/fish/alloc.c @@ -1,5 +1,5 @@ /* guestfish - the filesystem interactive shell - * Copyright (C) 2009 Red Hat Inc. + * Copyright (C) 2009 Red Hat Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,25 +30,25 @@ static int parse_size (const char *str, off_t *size_rtn); int -do_alloc (int argc, char *argv[]) +do_alloc (const char *cmd, int argc, char *argv[]) { off_t size; int fd; if (argc != 2) { - fprintf (stderr, "use 'alloc file size' to create an image\n"); + fprintf (stderr, _("use 'alloc file size' to create an image\n")); return -1; } if (parse_size (argv[1], &size) == -1) return -1; - if (g_launched) { - fprintf (stderr, "can't allocate or add disks after launching\n"); + if (!guestfs_is_config (g)) { + fprintf (stderr, _("can't allocate or add disks after launching\n")); return -1; } - fd = open (argv[0], O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666); + fd = open (argv[0], O_WRONLY|O_CREAT|O_NOCTTY|O_TRUNC, 0666); if (fd == -1) { perror (argv[0]); return -1; @@ -91,14 +91,14 @@ parse_size (const char *str, off_t *size_rtn) case 'g': case 'G': size *= 1024 * 1024 * 1024; break; case 's': size *= 512; break; default: - fprintf (stderr, "could not parse size specification '%s'\n", str); + fprintf (stderr, _("could not parse size specification '%s'\n"), str); return -1; } } else if (sscanf (str, "%"SCNu64, &size) == 1) size *= 1024; else { - fprintf (stderr, "could not parse size specification '%s'\n", str); + fprintf (stderr, _("could not parse size specification '%s'\n"), str); return -1; }