~ubuntu-branches/ubuntu/wily/xorg/wily

« back to all changes in this revision

Viewing changes to debian/local/xserver-wrapper.c

  • Committer: Package Import Robot
  • Author(s): Maarten Lankhorst
  • Date: 2015-03-09 11:51:24 UTC
  • Revision ID: package-import@ubuntu.com-20150309115124-2gvv2bn6xyd6c7y4
Tags: 1:7.7+7ubuntu3
* Modesetting has been removed, remove from vars.
* Do not require vesa on armhf, only fbdev is useful.

Show diffs side-by-side

added added

removed removed

Lines of Context:
255
255
                   X_WRAPPER_CONFIG_FILE); */
256
256
  }
257
257
 
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));
261
262
    exit(1);
262
263
  }
263
264
 
264
 
  i = readlink(X_SERVER_SYMLINK, xserver, 1024);
265
 
 
266
265
  if (i < 0) {
267
 
    (void) fprintf(stderr, "X: cannot read %s symbolic link (%s), aborting.\n",
268
 
                   X_SERVER_SYMLINK, strerror(errno));
269
 
    exit(1);
270
 
  }
271
 
 
272
 
  xserver[i] = '\0'; /* readlink() does not null-terminate the string */
273
 
 
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);
279
 
    exit(1);
280
 
  }
281
 
 
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");
 
267
  } else {
 
268
    i = readlink(X_SERVER_SYMLINK, xserver, 1024);
 
269
 
 
270
    if (i < 0) {
 
271
      (void) fprintf(stderr, "X: cannot read %s symbolic link (%s), aborting.\n",
 
272
                     X_SERVER_SYMLINK, strerror(errno));
 
273
      exit(1);
 
274
    }
 
275
    xserver[i] = '\0'; /* readlink() does not null-terminate the string */
 
276
 
 
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);
 
282
      exit(1);
 
283
    }
 
284
  }
 
285
 
 
286
  if (access(xserver, X_OK)) { /* access() uses real uid */
 
287
    (void) fprintf(stderr, "%s is not executable\n", val);
284
288
    exit(1);
285
289
  }
286
290
 
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
334
338
     */
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));
338
342
      exit(1);