diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-05 13:57:35 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2006-12-05 13:57:35 +0000 |
commit | fc1c20d11b5e95690ad5acf6bebd5cea129618e3 (patch) | |
tree | dae0e426a80d810870d6d30d05419d851af59ffc | |
parent | a9c4f66cfb1618833cc70ceaf13733730b634193 (diff) |
* Redundant.
-rwxr-xr-x | fix_setuid | 9 | ||||
-rw-r--r-- | socket/Makefile | 7 | ||||
-rw-r--r-- | socket/client.c | 43 | ||||
-rw-r--r-- | socket/server.c | 71 |
4 files changed, 0 insertions, 130 deletions
diff --git a/fix_setuid b/fix_setuid deleted file mode 100755 index 1a6dc58dc..000000000 --- a/fix_setuid +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh -if test -z "$prefix"; then prefix=/nix; fi -chown -Rf nix.nix $prefix/bin $prefix/etc $prefix/include $prefix/lib \ - $prefix/libexec $prefix/man $prefix/share $prefix/var -chown nix.nix $prefix/store -chmod 6755 $prefix/bin/nix-env $prefix/bin/nix-instantiate $prefix/bin/nix-store -chmod 775 $prefix/var/nix/manifests -chmod 775 $prefix/var/nix/gcroots/tmp -chmod 775 $prefix/var/nix/gcroots/channels diff --git a/socket/Makefile b/socket/Makefile deleted file mode 100644 index a9443f1c4..000000000 --- a/socket/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: server client - -server: server.c - gcc -Wall -o server server.c - -client: client.c - gcc -Wall -o client client.c diff --git a/socket/client.c b/socket/client.c deleted file mode 100644 index a132a7a9e..000000000 --- a/socket/client.c +++ /dev/null @@ -1,43 +0,0 @@ -#include <assert.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> - - -#define SOCKET_PATH "/tmp/nix-daemon" - - -int main(int argc, char * * argv) -{ - int res; - - int sock = socket(PF_UNIX, SOCK_STREAM, 0); - assert(sock != -1); - - struct sockaddr_un addr; - addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, SOCKET_PATH); - - res = connect(sock, (struct sockaddr *) &addr, sizeof(addr)); - assert(res != -1); - - int i; - for (i = 0; i < 100000; i++) { - int len = send(sock, &i, sizeof(i), 0); - assert(len == sizeof(i)); - - int j; - len = recv(sock, &j, sizeof(j), 0); - if (len < sizeof(j)) break; - assert(i * 2 == j); - } - - close(sock); - - return 0; -} diff --git a/socket/server.c b/socket/server.c deleted file mode 100644 index 4e457ac21..000000000 --- a/socket/server.c +++ /dev/null @@ -1,71 +0,0 @@ -#include <assert.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> - - -#define SOCKET_PATH "/tmp/nix-daemon" - - -int main(int argc, char * * argv) -{ - int res; - - int sock = socket(PF_UNIX, SOCK_STREAM, 0); - assert(sock != -1); - - unlink(SOCKET_PATH); - - struct sockaddr_un addr; - addr.sun_family = AF_UNIX; - strcpy(addr.sun_path, SOCKET_PATH); - - res = bind(sock, (struct sockaddr *) &addr, sizeof(addr)); - assert(res != -1); - - res = listen(sock, 5); - if (res == -1) - fprintf(stderr, "%s\n", strerror(errno)); - assert(res != -1); - - while (1) { - - struct sockaddr_un remoteAddr; - socklen_t remoteAddrLen = sizeof(remoteAddr); - - int remote = accept(sock, - (struct sockaddr *) &remoteAddr, &remoteAddrLen); - if (remote == -1) - fprintf(stderr, "%s\n", strerror(errno)); - assert(remote != -1); - - fprintf(stderr, "connection %d\n", remote); - - while (1) { - int i; - ssize_t len; - - len = recv(remote, &i, sizeof(i), 0); - if (len < sizeof(i)) break; - - // printf("%d\n", i); - - int j = i * 2; - len = send(remote, &j, sizeof(j), 0); - if (len == -1) - fprintf(stderr, "%s\n", strerror(errno)); - assert(len == sizeof(j)); - } - - close(remote); - } - - close(sock); - - return 0; -} |