Beispiel #1
0
	git_vector_foreach(contents, i, ps) {
		/* skip if before start_stat or after end_stat */
		cmp_len = min(start_len, ps->path_len);
		if (cmp_len && strncomp(ps->path, start_stat, cmp_len) < 0)
			continue;
		cmp_len = min(end_len, ps->path_len);
		if (cmp_len && strncomp(ps->path, end_stat, cmp_len) > 0)
			continue;

		git_buf_truncate(&full, prefix_len);

		if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 ||
			(error = git_path_lstat(full.ptr, &ps->st)) < 0) {
			if (error == GIT_ENOTFOUND) {
				giterr_clear();
				error = 0;
				git_vector_remove(contents, i--);
				continue;
			}

			break;
		}

		if (S_ISDIR(ps->st.st_mode)) {
			ps->path[ps->path_len++] = '/';
			ps->path[ps->path_len] = '\0';
		}
	}
Beispiel #2
0
	git_vector_foreach(contents, i, ps) {
		/* skip if before start_stat or after end_stat */
		cmp_len = min(start_len, ps->path_len);
		if (cmp_len && strncomp(ps->path, start_stat, cmp_len) < 0)
			continue;
		cmp_len = min(end_len, ps->path_len);
		if (cmp_len && strncomp(ps->path, end_stat, cmp_len) > 0)
			continue;

		git_buf_truncate(&full, prefix_len);

		if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 ||
			(error = git_path_lstat(full.ptr, &ps->st)) < 0)
			break;

		if (S_ISDIR(ps->st.st_mode)) {
			if ((error = git_buf_joinpath(&full, full.ptr, ".git")) < 0)
				break;

			if (p_access(full.ptr, F_OK) == 0) {
				ps->st.st_mode = GIT_FILEMODE_COMMIT;
			} else {
				ps->path[ps->path_len++] = '/';
				ps->path[ps->path_len] = '\0';
			}
		}
	}
Beispiel #3
0
	git_vector_foreach(contents, i, ps) {
		/* skip if before start_stat or after end_stat */
		cmp_len = min(start_len, ps->path_len);
		if (cmp_len && strncomp(ps->path, start_stat, cmp_len) < 0)
			continue;
		cmp_len = min(end_len, ps->path_len);
		if (cmp_len && strncomp(ps->path, end_stat, cmp_len) > 0)
			continue;

		git_buf_truncate(&full, prefix_len);

		if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 ||
			(error = git_path_lstat(full.ptr, &ps->st)) < 0) {

			if (error == GIT_ENOTFOUND) {
				/* file was removed between readdir and lstat */
				char *entry_path = git_vector_get(contents, i);
				git_vector_remove(contents, i--);
				git__free(entry_path);
			} else {
				/* Treat the file as unreadable if we get any other error */
				memset(&ps->st, 0, sizeof(ps->st));
				ps->st.st_mode = GIT_FILEMODE_UNREADABLE;
			}

			giterr_clear();
			error = 0;
			continue;
		}

		if (S_ISDIR(ps->st.st_mode)) {
			ps->path[ps->path_len++] = '/';
			ps->path[ps->path_len] = '\0';
		}
		else if (!S_ISREG(ps->st.st_mode) && !S_ISLNK(ps->st.st_mode)) {
			char *entry_path = git_vector_get(contents, i);
			git_vector_remove(contents, i--);
			git__free(entry_path);
		}
	}
/*ARGSUSED1*/
char *
CVMtimezoneFindJavaTZ(const char *java_home_dir, const char *country)
{
    char *tz;
    char *javatz = NULL;
    char *freetz = NULL;

    tz = getenv("TZ");

#ifdef __linux__
    if (tz == NULL) {
#else
#ifdef __solaris__
    if (tz == NULL || *tz == '\0') {
#endif
#endif
	tz = getPlatformTimeZoneID();
	freetz = tz;
    }

    if (tz != NULL) {
	if (*tz == ':') {
	    tz++;
	}
#ifdef __linix__
	/*
	 * Ignore "posix/" and "right/" prefix.
	 */
	if (strncmp(tz, "posix/", 6) == 0 || strncomp(tz, "right/", 6) == 0) {
	    tz += 6;
	}
#endif
	javatz = strdup(tz);
	if (freetz != NULL) {
	    free((void *) freetz);
	}
    }	
    return javatz;
}

/**
 * Returns a GMT-offset-based time zone ID. (e.g., "GMT-08:00")
 */
char *
CVMgetGMTOffsetID()
{
    time_t offset;
    char sign, buf[16];

    if (timezone == 0) {
	return strdup("GMT");
    }

    /* Note that the time offset direction is opposite. */
    if (timezone > 0) {
	offset = timezone;
	sign = '-';
    } else {
	offset = -timezone;
	sign = '+';
    }
    sprintf(buf, (const char *)"GMT%c%02d:%02d",
	    sign, (int)(offset/3600), (int)((offset%3600)/60));
    return strdup(buf);
}