- Change some open's to V_OPEN()'s

This commit is contained in:
Andi Gutmans 2000-04-30 19:01:17 +00:00
parent 1f64d98753
commit 5d5b09e1a7
8 changed files with 15 additions and 15 deletions

View File

@ -333,7 +333,7 @@ dbm_info *php_dbm_open(char *filename, char *mode) {
}
#else /* NFS_HACK */
lockfd = open(lockfn,O_RDWR|O_CREAT,0644);
lockfd = V_OPEN((lockfn,O_RDWR|O_CREAT,0644));
if (lockfd) {
flock(lockfd,LOCK_EX);
@ -428,7 +428,7 @@ int php_dbm_close(dbm_info *info) {
unlink(info->lockfn);
#else
if (info->lockfn) {
lockfd = open(info->lockfn,O_RDWR,0644);
lockfd = V_OPEN((info->lockfn,O_RDWR,0644));
flock(lockfd,LOCK_UN);
close(lockfd);
}

View File

@ -71,7 +71,7 @@ DBA_OPEN_FUNC(cdb)
cdb = malloc(sizeof *cdb);
memset(cdb, 0, sizeof *cdb);
cdb->fd = open(info->path, gmode);
cdb->fd = V_OPEN((info->path, gmode))
if(cdb->fd < 0) {
free(cdb);
return FAILURE;

View File

@ -51,7 +51,7 @@
#define TRUNC_IT(extension, mode) \
snprintf(buf, PATH_MAX, "%s" extension, info->path); \
buf[PATH_MAX] = '\0'; \
if((fd = open(buf, O_CREAT | mode | O_WRONLY, filemode)) == -1) \
if((fd = V_OPEN((buf, O_CREAT | mode | O_WRONLY, filemode))) == -1) \
return FAILURE; \
close(fd);

View File

@ -586,15 +586,15 @@ PHP_FUNCTION(dbase_create) {
RETURN_FALSE;
}
if (PG(safe_mode) && (!php_checkuid(filename->value.str.val, 2))) {
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_P(filename), 2))) {
RETURN_FALSE;
}
if (php_check_open_basedir(filename->value.str.val)) {
if (php_check_open_basedir(Z_STRVAL_P(filename))) {
RETURN_FALSE;
}
if ((fd = open(filename->value.str.val, O_BINARY|O_RDWR|O_CREAT, 0644)) < 0) {
if ((fd = V_OPEN((Z_STRVAL_P(filename), O_BINARY|O_RDWR|O_CREAT, 0644))) < 0) {
php_error(E_WARNING, "Unable to create database (%d): %s", errno, strerror(errno));
RETURN_FALSE;
}

View File

@ -226,10 +226,10 @@ dbhead_t *dbf_open(char *dp, int o_flags)
dbhead_t *dbh;
cp = dp;
if ((fd = open(cp, o_flags|O_BINARY)) < 0) {
if ((fd = V_OPEN((cp, o_flags|O_BINARY))) < 0) {
cp = (char *)malloc(256);
strcpy(cp, dp); strcat(cp, ".dbf");
if ((fd = open(cp, o_flags)) < 0) {
if ((fd = V_OPEN((cp, o_flags))) < 0) {
perror("open");
return NULL;
}

View File

@ -2690,7 +2690,7 @@ PHP_FUNCTION(ocisavelobfile)
filename = (*arg)->value.str.val;
if ((fp = open(filename, O_RDONLY)) == -1) {
if ((fp = V_OPEN((filename, O_RDONLY))) == -1) {
php_error(E_WARNING, "Can't open file %s", filename);
RETURN_FALSE;
}
@ -2812,7 +2812,7 @@ PHP_FUNCTION(ociwritelobtofile)
goto bail;
}
if ((fp = open(filename,O_CREAT|O_TRUNC|O_WRONLY)) == -1) {
if ((fp = V_OPEN((filename,O_CREAT|O_TRUNC|O_WRONLY))) == -1) {
php_error(E_WARNING, "Can't create file %s", filename);
goto bail;
}

View File

@ -132,16 +132,16 @@ static void _ps_files_open(ps_files *data, const char *key)
data->lastkey = estrdup(key);
#ifdef O_EXCL
data->fd = open(buf, O_RDWR);
data->fd = V_OPEN((buf, O_RDWR));
if (data->fd == -1) {
if (errno == ENOENT) {
data->fd = open(buf, O_EXCL | O_RDWR | O_CREAT, 0600);
data->fd = V_OPEN((buf, O_EXCL | O_RDWR | O_CREAT, 0600));
}
} else {
flock(data->fd, LOCK_EX);
}
#else
data->fd = open(buf, O_CREAT | O_RDWR, 0600);
data->fd = V_OPEN((buf, O_CREAT | O_RDWR, 0600));
if (data->fd != -1)
flock(data->fd, LOCK_EX);
#endif

View File

@ -394,7 +394,7 @@ static char *_php_create_id(int *newlen PSLS_DC)
if (PS(entropy_length) > 0) {
int fd;
fd = open(PS(entropy_file), O_RDONLY);
fd = V_OPEN((PS(entropy_file), O_RDONLY));
if (fd >= 0) {
char *p;
int n;