summary refs log tree commit diff
path: root/src/libstore/references.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2004-01-05 16:26:43 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2004-01-05 16:26:43 +0000
commit4a373a3e9ac07a2d4c43d495c0a44883106ecfde (patch)
tree27f4e22f8d3573bfe1ebba1acfa2e46a735fecee /src/libstore/references.cc
parentf83c5e3e5f3e6b33c095d6559a4b3cd5922e88ce (diff)
downloadguix-4a373a3e9ac07a2d4c43d495c0a44883106ecfde.tar.gz
* Implemented Eelco V.'s `nix-env -I' command to specify the default
  path of the Nix expression to be used with the import, upgrade, and
  query commands.  For instance,

  $ nix-env -I ~/nixpkgs/pkgs/system/i686-linux.nix

  $ nix-env --query --available   [aka -qa]
  sylpheed-0.9.7
  bison-1.875
  pango-1.2.5
  subversion-0.35.1
  ...

  $ nix-env -i sylpheed

  $ nix-env -u subversion

  There can be only one default at a time.

* If the path to a Nix expression is a symlink, follow the symlink
  prior to resolving relative path references in the expression.

Diffstat (limited to 'src/libstore/references.cc')
-rw-r--r--src/libstore/references.cc8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libstore/references.cc b/src/libstore/references.cc
index 2bea44131e..2daf4d4f4d 100644
--- a/src/libstore/references.cc
+++ b/src/libstore/references.cc
@@ -59,12 +59,8 @@ void checkPath(const string & path,
         delete buf; /* !!! autodelete */
     }
     
-    else if (S_ISLNK(st.st_mode)) {
-        char buf[st.st_size];
-        if (readlink(path.c_str(), buf, st.st_size) != st.st_size)
-            throw SysError(format("reading symbolic link `%1%'") % path);
-        search(string(buf, st.st_size), ids, seen);
-    }
+    else if (S_ISLNK(st.st_mode))
+        search(readLink(path), ids, seen);
     
     else throw Error(format("unknown file type: %1%") % path);
 }