summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2022-12-14 00:13:34 -0800
committerJeremy Huddleston Sequoia <jeremyhu@apple.com>2022-12-14 00:17:59 -0800
commitf73c4897716b60842e8d26aff70575637c4a7a9e (patch)
tree2d9e7ccd81d2ffc7cbbed6ff7b8fdefc53fccde8
parent3fd87692e8acafcc5941f818ee16232bd5c7b96e (diff)
downloadxserver-f73c4897716b60842e8d26aff70575637c4a7a9e.tar.gz
xquartz: Fix some formatting
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/mach-startup/stub.c62
1 files changed, 23 insertions, 39 deletions
diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c
index 469ad9ac0..83252e805 100644
--- a/hw/xquartz/mach-startup/stub.c
+++ b/hw/xquartz/mach-startup/stub.c
@@ -60,17 +60,15 @@ aslclient aslc;
static void
set_x11_path(void)
{
- OSStatus osstatus =
- LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(
- kX11AppBundleId), nil, &x11_appRef, &x11appURL);
+ OSStatus osstatus = LSFindApplicationForInfo(kLSUnknownCreator, CFSTR(kX11AppBundleId),
+ nil, &x11_appRef, &x11appURL);
switch (osstatus) {
case noErr:
if (x11appURL == NULL) {
- asl_log(
- aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
- kX11AppBundleId);
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Invalid response from LSFindApplicationForInfo(%s)",
+ kX11AppBundleId);
exit(1);
}
break;
@@ -84,8 +82,7 @@ set_x11_path(void)
default:
asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: Unable to find application for %s, error code = %d",
- kX11AppBundleId,
- (int)osstatus);
+ kX11AppBundleId, (int)osstatus);
exit(11);
}
}
@@ -110,18 +107,15 @@ connect_to_socket(const char *filename)
ret_fd = socket(PF_UNIX, SOCK_STREAM, 0);
if (ret_fd == -1) {
asl_log(aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Failed to create socket: %s - %s", filename,
- strerror(
- errno));
+ "Xquartz: Failed to create socket: %s - %d - %s",
+ filename, errno, strerror(errno));
return -1;
}
if (connect(ret_fd, servaddr, servaddr_len) < 0) {
asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: Failed to connect to socket: %s - %d - %s",
- filename, errno,
- strerror(
- errno));
+ filename, errno, strerror(errno));
close(ret_fd);
return -1;
}
@@ -164,10 +158,9 @@ send_fd_handoff(int connected_fd, int launchd_fd)
*((int *)CMSG_DATA(cmsg)) = launchd_fd;
if (sendmsg(connected_fd, &msg, 0) < 0) {
- asl_log(
- aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s",
- connected_fd, errno, strerror(errno));
+ asl_log(aslc, NULL, ASL_LEVEL_ERR,
+ "Xquartz: Error sending $DISPLAY file descriptor over fd %d: %d -- %s",
+ connected_fd, errno, strerror(errno));
return;
}
@@ -270,8 +263,7 @@ main(int argc, char **argv, char **envp)
if (kr != KERN_SUCCESS) {
asl_log(aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(
- kr));
+ "Xquartz: bootstrap_look_up(): %s", bootstrap_strerror(kr));
return EXIT_FAILURE;
}
}
@@ -285,13 +277,10 @@ main(int argc, char **argv, char **envp)
int handoff_fd = -1;
for (try = 0, try_max = 5; try < try_max; try++) {
- if (request_fd_handoff_socket(mp,
- handoff_socket_filename) !=
- KERN_SUCCESS) {
- asl_log(
- aslc, NULL, ASL_LEVEL_INFO,
- "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)",
- (int)try + 1, (int)try_max);
+ if (request_fd_handoff_socket(mp, handoff_socket_filename) != KERN_SUCCESS) {
+ asl_log(aslc, NULL, ASL_LEVEL_INFO,
+ "Xquartz: Failed to request a socket from the server to send the $DISPLAY fd over (try %d of %d)",
+ (int)try + 1, (int)try_max);
continue;
}
@@ -299,16 +288,13 @@ main(int argc, char **argv, char **envp)
if (handoff_fd == -1) {
asl_log(aslc, NULL, ASL_LEVEL_ERR,
"Xquartz: Failed to connect to socket (try %d of %d)",
- (int)try + 1,
- (int)try_max);
+ (int)try + 1, (int)try_max);
continue;
}
- asl_log(
- aslc, NULL, ASL_LEVEL_INFO,
- "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\". Sending message.",
- (int)try + 1, (int)try_max, handoff_fd,
- handoff_socket_filename);
+ asl_log(aslc, NULL, ASL_LEVEL_INFO,
+ "Xquartz: Handoff connection established (try %d of %d) on fd %d, \"%s\". Sending message.",
+ (int)try + 1, (int)try_max, handoff_fd, handoff_socket_filename);
send_fd_handoff(handoff_fd, launchd_fd);
close(handoff_fd);
break;
@@ -329,8 +315,7 @@ main(int argc, char **argv, char **envp)
free(newargv);
free(newenvp);
- asl_log(aslc, NULL, ASL_LEVEL_ERR,
- "Xquartz: Memory allocation failure");
+ asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: Memory allocation failure");
return EXIT_FAILURE;
}
@@ -348,8 +333,7 @@ main(int argc, char **argv, char **envp)
if (kr != KERN_SUCCESS) {
asl_log(aslc, NULL, ASL_LEVEL_ERR, "Xquartz: start_x11_server: %s",
- mach_error_string(
- kr));
+ mach_error_string(kr));
return EXIT_FAILURE;
}
return EXIT_SUCCESS;