Ticket #3255 (new bug)
malformed unix socket filename
| Reported by: | kaliber | Owned by: | bonefish |
|---|---|---|---|
| Priority: | normal | Milestone: | R1 |
| Component: | Network & Internet | Version: | R1/pre-alpha1 |
| Keywords: | Cc: | ||
| Blocked By: | Platform: | All | |
| Blocking: |
Description
Attached code creates 'socket_test_filenam\302K\200\C' instead of 'socket_test_filename'. It works on linux.
gcc socket.c -lnetwork
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#define SOCK_PATH "socket_test_filename"
int main(void)
{
int s, len;
struct sockaddr_un local;
char str[100];
if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
perror("socket");
exit(1);
}
local.sun_family = AF_UNIX;
strcpy(local.sun_path, SOCK_PATH);
unlink(local.sun_path);
len = strlen(local.sun_path) + sizeof(local.sun_family);
if (bind(s, (struct sockaddr *)&local, len) == -1) {
perror("bind");
exit(1);
}
return 0;
}
Change History
Note: See
TracTickets for help on using
tickets.
