static int vnc_set_x509_credential(VncDisplay *vs,

				   const char *certdir,

				   const char *filename,

				   char **cred,

				   int ignoreMissing)

{

    struct stat sb;



    if (*cred) {

	qemu_free(*cred);

	*cred = NULL;

    }



    *cred = qemu_malloc(strlen(certdir) + strlen(filename) + 2);



    strcpy(*cred, certdir);

    strcat(*cred, "/");

    strcat(*cred, filename);



    VNC_DEBUG("Check %s\n", *cred);

    if (stat(*cred, &sb) < 0) {

	qemu_free(*cred);

	*cred = NULL;

	if (ignoreMissing && errno == ENOENT)

	    return 0;

	return -1;

    }



    return 0;

}

static int vnc_set_x509_credential(VncDisplay *vs,

				   const char *certdir,

				   const char *filename,

				   char **cred,

				   int ignoreMissing)

{

    struct stat sb;



    if (*cred) {

	qemu_free(*cred);

	*cred = NULL;

    }



    *cred = qemu_malloc(strlen(certdir) + strlen(filename) + 2);



    strcpy(*cred, certdir);

    strcat(*cred, "/");

    strcat(*cred, filename);



    VNC_DEBUG("Check %s\n", *cred);

    if (stat(*cred, &sb) < 0) {

	qemu_free(*cred);

	*cred = NULL;

	if (ignoreMissing && errno == ENOENT)

	    return 0;

	return -1;

    }



    return 0;

}

static int FUNC_0(VncDisplay *VAR_0,

				   const char *VAR_1,

				   const char *VAR_2,

				   char **VAR_3,

				   int VAR_4)

{

    struct stat VAR_5;



    if (*VAR_3) {

	qemu_free(*VAR_3);

	*VAR_3 = NULL;

    }



    *VAR_3 = qemu_malloc(strlen(VAR_1) + strlen(VAR_2) + 2);



    strcpy(*VAR_3, VAR_1);

    strcat(*VAR_3, "/");

    strcat(*VAR_3, VAR_2);



    VNC_DEBUG("Check %s\n", *VAR_3);

    if (stat(*VAR_3, &VAR_5) < 0) {

	qemu_free(*VAR_3);

	*VAR_3 = NULL;

	if (VAR_4 && errno == ENOENT)

	    return 0;

	return -1;

    }



    return 0;

}

static int FUNC_0(VncDisplay *VAR_0,
const char *VAR_1,
const char *VAR_2,
char **VAR_3,
int VAR_4)
{ struct stat VAR_5; if (*VAR_3) { qemu_free(*VAR_3); *VAR_3 = NULL; } *VAR_3 = qemu_malloc(strlen(VAR_1) + strlen(VAR_2) + 2); strcpy(*VAR_3, VAR_1); strcat(*VAR_3, "/"); strcat(*VAR_3, VAR_2); VNC_DEBUG("Check %s\n", *VAR_3); if (stat(*VAR_3, &VAR_5) < 0) { qemu_free(*VAR_3); *VAR_3 = NULL; if (VAR_4 && errno == ENOENT)
return 0; return -1; } return 0; }