comparison src/core.c @ 2503:b4ac3b5f484b

[gaim-migrate @ 2516] there committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 14 Oct 2001 19:43:25 +0000
parents 7e4757801725
children 8229710b343b
comparison
equal deleted inserted replaced
2502:a452084e1636 2503:b4ac3b5f484b
406 { 406 {
407 struct sockaddr_un saddr; 407 struct sockaddr_un saddr;
408 gint fd; 408 gint fd;
409 409
410 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) { 410 if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) != -1) {
411 umask(0177); 411 mode_t m = umask(0177);
412 saddr.sun_family = AF_UNIX; 412 saddr.sun_family = AF_UNIX;
413 g_snprintf(saddr.sun_path, 108, "%s/gaim_%s.%d", 413 g_snprintf(saddr.sun_path, 108, "%s/gaim_%s.%d",
414 g_get_tmp_dir(), g_get_user_name(), getpid()); 414 g_get_tmp_dir(), g_get_user_name(), getpid());
415 if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) != -1) 415 if (bind(fd, (struct sockaddr *)&saddr, sizeof(saddr)) != -1)
416 listen(fd, 100); 416 listen(fd, 100);
417 else 417 else
418 g_log(NULL, G_LOG_LEVEL_CRITICAL, 418 g_log(NULL, G_LOG_LEVEL_CRITICAL,
419 "Failed to assign %s to a socket (Error: %s)", 419 "Failed to assign %s to a socket (Error: %s)",
420 saddr.sun_path, strerror(errno)); 420 saddr.sun_path, strerror(errno));
421 umask(m);
421 } else 422 } else
422 g_log(NULL, G_LOG_LEVEL_CRITICAL, "Unable to open socket: %s", strerror(errno)); 423 g_log(NULL, G_LOG_LEVEL_CRITICAL, "Unable to open socket: %s", strerror(errno));
423 return fd; 424 return fd;
424 } 425 }
425 426