Lines Matching refs:buf
107 static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const char *key) in ps_files_path_create() argument
121 memcpy(buf, data->basedir, data->basedir_len); in ps_files_path_create()
123 buf[n++] = PHP_DIR_SEPARATOR; in ps_files_path_create()
125 buf[n++] = *p++; in ps_files_path_create()
126 buf[n++] = PHP_DIR_SEPARATOR; in ps_files_path_create()
128 memcpy(buf + n, FILE_PREFIX, sizeof(FILE_PREFIX) - 1); in ps_files_path_create()
130 memcpy(buf + n, key, key_len); in ps_files_path_create()
132 buf[n] = '\0'; in ps_files_path_create()
134 return buf; in ps_files_path_create()
156 char buf[MAXPATHLEN]; in ps_files_open() local
175 if (!ps_files_path_create(buf, sizeof(buf), data, key)) { in ps_files_open()
184 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode); in ps_files_open()
188 …if(PG(open_basedir) && lstat(buf, &sbuf) == 0 && S_ISLNK(sbuf.st_mode) && php_check_open_basedir(b… in ps_files_open()
191 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode); in ps_files_open()
224 …php_error_docref(NULL, E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf, strerror(errno), errno); in ps_files_open()
253 char *buf = ZSTR_VAL(val); in ps_files_write() local
257 wrote = _write(data->fd, buf, to_write); in ps_files_write()
260 buf = wrote > -1 ? buf + wrote : 0; in ps_files_write()
287 char buf[MAXPATHLEN]; in ps_files_cleanup_dir() local
309 memcpy(buf, dirname, dirname_len); in ps_files_cleanup_dir()
310 buf[dirname_len] = PHP_DIR_SEPARATOR; in ps_files_cleanup_dir()
320 memcpy(buf + dirname_len + 1, entry->d_name, entry_len); in ps_files_cleanup_dir()
323 buf[dirname_len + entry_len + 1] = '\0'; in ps_files_cleanup_dir()
326 if (VCWD_STAT(buf, &sbuf) == 0 && in ps_files_cleanup_dir()
328 VCWD_UNLINK(buf); in ps_files_cleanup_dir()
342 char buf[MAXPATHLEN]; in ps_files_key_exists() local
345 if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) { in ps_files_key_exists()
348 if (VCWD_STAT(buf, &sbuf)) { in ps_files_key_exists()
504 char *buf = ZSTR_VAL(*val); in PS_READ_FUNC() local
508 read_in = _read(data->fd, buf, to_read); in PS_READ_FUNC()
511 buf = read_in > -1 ? buf + read_in : 0; in PS_READ_FUNC()
570 char buf[MAXPATHLEN]; in PS_UPDATE_TIMESTAMP_FUNC() local
574 if (!ps_files_path_create(buf, sizeof(buf), data, ZSTR_VAL(key))) { in PS_UPDATE_TIMESTAMP_FUNC()
579 ret = VCWD_UTIME(buf, NULL); in PS_UPDATE_TIMESTAMP_FUNC()
601 char buf[MAXPATHLEN]; in PS_DESTROY_FUNC() local
604 if (!ps_files_path_create(buf, sizeof(buf), data, ZSTR_VAL(key))) { in PS_DESTROY_FUNC()
611 if (VCWD_UNLINK(buf) == -1) { in PS_DESTROY_FUNC()
614 if (!VCWD_ACCESS(buf, F_OK)) { in PS_DESTROY_FUNC()