255
255
X_WRAPPER_CONFIG_FILE); */
258
if (lstat(X_SERVER_SYMLINK, &statbuf)) {
258
i = lstat(X_SERVER_SYMLINK, &statbuf);
259
if (i < 0 && errno != ENOENT) {
259
260
(void) fprintf(stderr, "X: cannot stat %s (%s), aborting.\n",
260
261
X_SERVER_SYMLINK, strerror(errno));
264
i = readlink(X_SERVER_SYMLINK, xserver, 1024);
267
(void) fprintf(stderr, "X: cannot read %s symbolic link (%s), aborting.\n",
268
X_SERVER_SYMLINK, strerror(errno));
272
xserver[i] = '\0'; /* readlink() does not null-terminate the string */
274
if ((strcmp(xserver, "/usr/bin/X11/X") == 0) ||
275
(strcmp(xserver, "/usr/X11R6/bin/X") == 0) ||
276
(strcmp(xserver, "/usr/bin/X") == 0)) {
277
(void) fprintf(stderr, "X: %s points back to X wrapper executable, "
278
"aborting.\n", X_SERVER_SYMLINK);
282
if (access(X_SERVER_SYMLINK, X_OK)) { /* access() uses real uid */
283
(void) fprintf(stderr, "%s is not executable\n", X_SERVER_SYMLINK);
266
strcpy(xserver, "/usr/bin/Xorg");
268
i = readlink(X_SERVER_SYMLINK, xserver, 1024);
271
(void) fprintf(stderr, "X: cannot read %s symbolic link (%s), aborting.\n",
272
X_SERVER_SYMLINK, strerror(errno));
275
xserver[i] = '\0'; /* readlink() does not null-terminate the string */
277
if ((strcmp(xserver, "/usr/bin/X11/X") == 0) ||
278
(strcmp(xserver, "/usr/X11R6/bin/X") == 0) ||
279
(strcmp(xserver, "/usr/bin/X") == 0)) {
280
(void) fprintf(stderr, "X: %s points back to X wrapper executable, "
281
"aborting.\n", X_SERVER_SYMLINK);
286
if (access(xserver, X_OK)) { /* access() uses real uid */
287
(void) fprintf(stderr, "%s is not executable\n", val);
332
336
* change to the directory where the X server symlink is so that a relative
333
337
* symlink will work and execute the X server
335
if (chdir(X_SERVER_SYMLINK_DIR)) {
339
if (xserver[0] != '/' && chdir(X_SERVER_SYMLINK_DIR)) {
336
340
(void) fprintf(stderr, "X: cannot chdir() to %s (%s), aborting.\n",
337
341
X_SERVER_SYMLINK_DIR, strerror(errno));