lkml.org 
[lkml]   [2000]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectUsers unable to create file sockets as of 2.3.50
The following code, when run as a non-root user, stopped working as
of 2.3.50 (at least for me).

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>

int main(void) {
struct sockaddr_un sock_struct = {AF_UNIX, "/tmp/blah.socket"};
int sd;

if ((sd = socket(PF_UNIX, SOCK_STREAM, 0)) == -1) {
printf ("Failed to create socket\n");
return -1;
}

unlink (sock_struct.sun_path);
if (bind(sd, &sock_struct, SUN_LEN(&sock_struct))) {
printf ("Failed to bind to socket\n");
return -1;
}

printf ("All successful\n");
unlink (sock_struct.sun_path);

return 0;
}
--
Chris Buchanan
Intermediate Software Developer
Navtech Inc., Waterloo, Ontario, Canada

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.038 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site