Commit Graph

20 Commits

Author SHA1 Message Date
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard W.M. Jones
9ff9941836 daemon: Don't use ../src path to include generator_protocol.h
This file is already hard-linked into the current directory, so
the relative path is not required.
2010-11-03 13:15:19 +00:00
Richard Jones
3a99114360 daemon: Move 'exists', 'is-file' and 'is-dir' to separate file.
This commit is just code movement.
2010-09-09 22:45:22 +01:00
Richard Jones
61ab83d190 Improved checking, documentation of modes (RHBZ#582901, RHBZ#582929).
chmod: Disallow negative mode, document mode affected by umask.

mkdir-mode: Disallow negative mode, document that filesystems
may interpret the mode in different ways.

mknod: Disallow negative mode, document mode affected by umask.

umask: Check the range of umask mask value carefully.
2010-04-17 13:36:26 +01:00
Richard Jones
e9c3711310 daemon: Don't need to prefix error messages with the command name.
The RPC stubs already prefix the command name to error messages.
The daemon doesn't have to do this.  As a (small) benefit this also
makes the daemon slightly smaller.

Code in the daemon such as:

  if (argv[0] == NULL) {
    reply_with_error ("passed an empty list");
    return NULL;
  }

now results in error messages like this:

  ><fs> command ""
  libguestfs: error: command: passed an empty list

(whereas previously you would have seen ..command: command:..)
2010-02-12 16:49:00 +00:00
Richard Jones
4b4e0d0d07 daemon error handling: recursive_mkdir shouldn't need to set errno. 2009-12-07 11:13:11 +00:00
Jim Meyering
9a8889e4d0 use STREQ, not strcmp: part 1
git grep -l 'strcmp *([^=]*== *0'|xargs \
  perl -pi -e 's/\bstrcmp( *\(.*?\)) *== *0/STREQ$1/g'
2009-11-09 22:34:16 +01:00
Richard Jones
2eb19f5261 New API calls: truncate, truncate_size, mkdir_mode, utimens, lchown.
truncate, truncate_size: Used to truncate files to a particular
size, or to zero bytes.

mkdir_mode: Like mkdir but allows you to also specify the
initial permissions for the new directory.

utimens: Set timestamp on a file with nanosecond accuracy.

lchown: Corresponding to lchown(2) syscall (we already have chown).

The implementation is complicated by the fact that we had to
add an Int64 parameter type to the generator.
2009-11-02 16:37:51 +00:00
Jim Meyering
1f0810eb3a generator.ml: constify do_mkdtemp
* daemon/dir.c (do_mkdtemp): Rewrite for a "const" parameter.
* src/generator.ml (mkdtemp): Declare parameter to be of type Pathname.
2009-08-13 14:45:34 +02:00
Jim Meyering
84fc760439 generator.ml: use new "Pathname" designation
Nearly every file-related function in daemons/*.c is affected:
Remove this pair of statements from each affected do_* function:
-  NEED_ROOT (return -1);
-  ABS_PATH (dir, return -1);
and change the type of the corresponding parameter to "const char *".
* src/generator.ml: Emit NEED_ROOT just once, even when there are two or
more Pathname args.
2009-08-13 14:45:34 +02:00
Jim Meyering
6bda071b5c update all NEED_ROOT uses
run this command:
  git grep -l -w NEED_ROOT|xargs perl -pi -e \
    's/(NEED_ROOT) \((.*?)\)/$1 (return $2)/'
2009-08-13 14:45:34 +02:00
Jim Meyering
0dd6c8c844 update all uses of ABS_PATH
run this command:
  git grep -l -w ABS_PATH|xargs perl -pi -e \
    's/(?:ABS_PATH)( \(.*?,) (.*?)\)/ABS_PATH$1 return $2)/'
2009-08-13 14:45:34 +02:00
Jim Meyering
2f1a50d816 Convert all TABs-as-indentation to spaces.
Do it by running this command:
[exempted files are matched via .x-sc_TAB_in_indentation]

  git ls-files \
    | pcregrep -vf .x-sc_TAB_in_indentation \
    | xargs pcregrep -l '^ *\t' \
    | xargs perl -MText::Tabs -ni -le \
      '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-08-03 17:17:57 +02:00
Richard Jones
78029b529a Make /sysroot path configurable.
Currently /sysroot is hard-coded throughout the daemon code.

This patch turns the path into a variable so that we can change
it in future, for example to allow standalone mode to be implemented.

This patch was tested by running all the C API tests successfully.
2009-07-18 10:43:52 +01:00
Jim Meyering
a7b73d4a1e remove trailing blanks 2009-07-03 17:04:21 +02:00
Richard W.M. Jones
8228eec990 Add mkdtemp command. 2009-06-24 18:22:37 +01:00
Richard Jones
56bef498f4 In the daemon, change all const char * parameters to char *. 2009-06-10 14:16:47 +01:00
Richard W.M. Jones
f6e36bf361 Fix mkdir-p if directory exists (RHBZ#503133). 2009-05-29 11:20:29 +01:00
Richard Jones
b4d2a01828 Added test suite. 2009-04-11 17:04:35 +01:00
Richard Jones
44da812b42 New commands: rm rmdir rm-rf mkdir mkdir-p chmod chown 2009-04-10 12:55:04 +01:00