Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4724903c78e8
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 77a78af67862
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Feb 13, 2017

  1. nix-daemon: Don't splice with len=SIZE_MAX

    Currently, 'nix-daemon --stdio' is always failing for me, due to the
    splice call always failing with (on a 32-bit host):
    
    splice(0, NULL, 3, NULL, 4294967295, SPLICE_F_MOVE) = -1 EINVAL (Invalid argument)
    
    With a bit of ftracing (and luck) the problem seems to be that splice()
    always fails with EINVAL if the len cast as ssize_t is negative:
    http://lxr.free-electrons.com/source/fs/read_write.c?v=4.4#L384
    
    So use SSIZE_MAX instead of SIZE_MAX.
    dezgeg committed Feb 13, 2017
    Copy the full SHA
    649a81b View commit details
  2. Merge pull request #1233 from dezgeg/splice

    nix-daemon: Don't splice with len=SIZE_MAX
    edolstra authored Feb 13, 2017
    Copy the full SHA
    77a78af View commit details
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/nix-daemon/nix-daemon.cc
5 changes: 3 additions & 2 deletions src/nix-daemon/nix-daemon.cc
Original file line number Diff line number Diff line change
@@ -23,6 +23,7 @@
#include <pwd.h>
#include <grp.h>
#include <fcntl.h>
#include <limits.h>

#if __APPLE__ || __FreeBSD__
#include <sys/ucred.h>
@@ -967,14 +968,14 @@ int main(int argc, char * * argv)
if (select(nfds, &fds, nullptr, nullptr, nullptr) == -1)
throw SysError("waiting for data from client or server");
if (FD_ISSET(s, &fds)) {
auto res = splice(s, nullptr, STDOUT_FILENO, nullptr, SIZE_MAX, SPLICE_F_MOVE);
auto res = splice(s, nullptr, STDOUT_FILENO, nullptr, SSIZE_MAX, SPLICE_F_MOVE);
if (res == -1)
throw SysError("splicing data from daemon socket to stdout");
else if (res == 0)
throw EndOfFile("unexpected EOF from daemon socket");
}
if (FD_ISSET(STDIN_FILENO, &fds)) {
auto res = splice(STDIN_FILENO, nullptr, s, nullptr, SIZE_MAX, SPLICE_F_MOVE);
auto res = splice(STDIN_FILENO, nullptr, s, nullptr, SSIZE_MAX, SPLICE_F_MOVE);
if (res == -1)
throw SysError("splicing data from stdin to daemon socket");
else if (res == 0)