mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-11-18 10:15:13 +00:00
Fixed a bug that regular files could not be created by mknod
This commit is contained in:
parent
73b49c1038
commit
f11eb7d69b
@ -1545,7 +1545,7 @@ int FdEntity::RowFlushMultipart(PseudoFdInfo* pseudo_obj, const char* tpath)
|
|||||||
S3FS_PRN_ERR("failed to truncate file(physical_fd=%d) to zero, but continue...", physical_fd);
|
S3FS_PRN_ERR("failed to truncate file(physical_fd=%d) to zero, but continue...", physical_fd);
|
||||||
}
|
}
|
||||||
// put pending headers or create new file
|
// put pending headers or create new file
|
||||||
if(0 != (result = UploadPending())){
|
if(0 != (result = UploadPending(-1))){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1673,7 +1673,7 @@ int FdEntity::RowFlushMixMultipart(PseudoFdInfo* pseudo_obj, const char* tpath)
|
|||||||
S3FS_PRN_ERR("failed to truncate file(physical_fd=%d) to zero, but continue...", physical_fd);
|
S3FS_PRN_ERR("failed to truncate file(physical_fd=%d) to zero, but continue...", physical_fd);
|
||||||
}
|
}
|
||||||
// put pending headers or create new file
|
// put pending headers or create new file
|
||||||
if(0 != (result = UploadPending())){
|
if(0 != (result = UploadPending(-1))){
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ class FdEntity
|
|||||||
int GetPhysicalFd() const { return physical_fd; }
|
int GetPhysicalFd() const { return physical_fd; }
|
||||||
bool IsModified() const;
|
bool IsModified() const;
|
||||||
bool MergeOrgMeta(headers_t& updatemeta);
|
bool MergeOrgMeta(headers_t& updatemeta);
|
||||||
int UploadPending(int fd = -1);
|
int UploadPending(int fd);
|
||||||
|
|
||||||
bool GetStats(struct stat& st, bool lock_already_held = false);
|
bool GetStats(struct stat& st, bool lock_already_held = false);
|
||||||
int SetCtime(struct timespec time, bool lock_already_held = false);
|
int SetCtime(struct timespec time, bool lock_already_held = false);
|
||||||
|
@ -82,7 +82,7 @@ bool TestMknod(const char* basepath, mode_t mode)
|
|||||||
break;
|
break;
|
||||||
case S_IFBLK:
|
case S_IFBLK:
|
||||||
str_mode = str_mode_blk;
|
str_mode = str_mode_blk;
|
||||||
dev = makedev((long long)(259), 0); // temporary value
|
dev = makedev((unsigned int)(259), 0); // temporary value
|
||||||
sprintf(filepath, "%s.%s", basepath, str_ext_blk);
|
sprintf(filepath, "%s.%s", basepath, str_ext_blk);
|
||||||
break;
|
break;
|
||||||
case S_IFIFO:
|
case S_IFIFO:
|
||||||
@ -93,7 +93,8 @@ bool TestMknod(const char* basepath, mode_t mode)
|
|||||||
case S_IFSOCK:
|
case S_IFSOCK:
|
||||||
str_mode = str_mode_sock;
|
str_mode = str_mode_sock;
|
||||||
dev = 0;
|
dev = 0;
|
||||||
sprintf(filepath, "%s.%s", basepath, str_ext_sock);
|
snprintf(filepath, S3FS_TEST_PATH_MAX, "%s.%s", basepath, str_ext_sock);
|
||||||
|
filepath[S3FS_TEST_PATH_MAX - 1] = '\0'; // for safety
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "[ERROR] Called function with wrong mode argument.\n");
|
fprintf(stderr, "[ERROR] Called function with wrong mode argument.\n");
|
||||||
@ -137,11 +138,11 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
// Parse parameters
|
// Parse parameters
|
||||||
if(2 != argc){
|
if(2 != argc){
|
||||||
fprintf(stderr, "[ERROR] No paraemter is specified.\n");
|
fprintf(stderr, "[ERROR] No parameter is specified.\n");
|
||||||
fprintf(stderr, "%s\n", usage_string);
|
fprintf(stderr, "%s\n", usage_string);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if(0 == strcasecmp("-h", argv[1]) || 0 == strcasecmp("--help", argv[1])){
|
if(0 == strcmp("-h", argv[1]) || 0 == strcmp("--help", argv[1])){
|
||||||
fprintf(stdout, "%s\n", usage_string);
|
fprintf(stdout, "%s\n", usage_string);
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
@ -155,6 +156,9 @@ int main(int argc, char *argv[])
|
|||||||
// [NOTE]
|
// [NOTE]
|
||||||
// Privilege is required to execute S_IFBLK.
|
// Privilege is required to execute S_IFBLK.
|
||||||
//
|
//
|
||||||
|
if(0 != geteuid()){
|
||||||
|
fprintf(stderr, "[WARNING] Skipping mknod(S_IFBLK) due to missing root privileges.\n");
|
||||||
|
}
|
||||||
if(!TestMknod(argv[1], S_IFREG) ||
|
if(!TestMknod(argv[1], S_IFREG) ||
|
||||||
!TestMknod(argv[1], S_IFCHR) ||
|
!TestMknod(argv[1], S_IFCHR) ||
|
||||||
!TestMknod(argv[1], S_IFIFO) ||
|
!TestMknod(argv[1], S_IFIFO) ||
|
||||||
|
Loading…
Reference in New Issue
Block a user