Lines Matching refs:buf
109 static char *ps_files_path_create(char *buf, size_t buflen, ps_files *data, const char *key) in ps_files_path_create() argument
123 memcpy(buf, data->basedir, data->basedir_len); in ps_files_path_create()
125 buf[n++] = PHP_DIR_SEPARATOR; in ps_files_path_create()
127 buf[n++] = *p++; in ps_files_path_create()
128 buf[n++] = PHP_DIR_SEPARATOR; in ps_files_path_create()
130 memcpy(buf + n, FILE_PREFIX, sizeof(FILE_PREFIX) - 1); in ps_files_path_create()
132 memcpy(buf + n, key, key_len); in ps_files_path_create()
134 buf[n] = '\0'; in ps_files_path_create()
136 return buf; in ps_files_path_create()
158 char buf[MAXPATHLEN]; in ps_files_open() local
177 if (!ps_files_path_create(buf, sizeof(buf), data, key)) { in ps_files_open()
186 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode); in ps_files_open()
190 …if(PG(open_basedir) && lstat(buf, &sbuf) == 0 && S_ISLNK(sbuf.st_mode) && php_check_open_basedir(b… in ps_files_open()
193 data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode); in ps_files_open()
226 …php_error_docref(NULL, E_WARNING, "open(%s, O_RDWR) failed: %s (%d)", buf, strerror(errno), errno); in ps_files_open()
255 char *buf = ZSTR_VAL(val); in ps_files_write() local
259 wrote = _write(data->fd, buf, to_write); in ps_files_write()
262 buf = wrote > -1 ? buf + wrote : 0; in ps_files_write()
290 char buf[MAXPATHLEN]; in ps_files_cleanup_dir() local
312 memcpy(buf, dirname, dirname_len); in ps_files_cleanup_dir()
313 buf[dirname_len] = PHP_DIR_SEPARATOR; in ps_files_cleanup_dir()
323 memcpy(buf + dirname_len + 1, entry->d_name, entry_len); in ps_files_cleanup_dir()
326 buf[dirname_len + entry_len + 1] = '\0'; in ps_files_cleanup_dir()
329 if (VCWD_STAT(buf, &sbuf) == 0 && in ps_files_cleanup_dir()
331 VCWD_UNLINK(buf); in ps_files_cleanup_dir()
345 char buf[MAXPATHLEN]; in ps_files_key_exists() local
348 if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) { in ps_files_key_exists()
351 if (VCWD_STAT(buf, &sbuf)) { in ps_files_key_exists()
507 char *buf = ZSTR_VAL(*val); in PS_READ_FUNC() local
511 read_in = _read(data->fd, buf, to_read); in PS_READ_FUNC()
514 buf = read_in > -1 ? buf + read_in : 0; in PS_READ_FUNC()
573 char buf[MAXPATHLEN]; in PS_UPDATE_TIMESTAMP_FUNC() local
579 if (!ps_files_path_create(buf, sizeof(buf), data, ZSTR_VAL(key))) { in PS_UPDATE_TIMESTAMP_FUNC()
589 ret = VCWD_UTIME(buf, newtime); in PS_UPDATE_TIMESTAMP_FUNC()
611 char buf[MAXPATHLEN]; in PS_DESTROY_FUNC() local
614 if (!ps_files_path_create(buf, sizeof(buf), data, ZSTR_VAL(key))) { in PS_DESTROY_FUNC()
621 if (VCWD_UNLINK(buf) == -1) { in PS_DESTROY_FUNC()
624 if (!VCWD_ACCESS(buf, F_OK)) { in PS_DESTROY_FUNC()