Skip to content

Commit

Permalink
Tweaks to library
Browse files Browse the repository at this point in the history
  • Loading branch information
Ebenezer-group committed Oct 12, 2024
1 parent 255ee8f commit 412b09b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/cmwBuffer.hh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ inline int Read (int fd,void* data,int len){
raise("Read",len,errno);
}

inline int openWrapper (auto nm,int flags,mode_t md){
inline int openWrapper (auto nm,int flags,mode_t md=0){
if(int d=::open(nm,flags,md);d>0)return d;
raise("openWrapper",nm,errno);
}
Expand All @@ -138,9 +138,6 @@ class FileWrapper{
FileWrapper (){}
FileWrapper (auto nm,int flags,mode_t md):d{openWrapper(nm,flags,md)}{}

FileWrapper (auto nm,mode_t md):
FileWrapper(nm,O_CREAT|O_WRONLY|O_TRUNC,md){}

FileWrapper (FileWrapper const&)=delete;
void operator= (FileWrapper&)=delete;

Expand Down Expand Up @@ -438,7 +435,7 @@ template<class Z>class SendBuffer{
int receiveFile (char const* nm,::int32_t sz){
receive(&sz,sizeof sz);
auto prev=reserveBytes(sz);
int fd=openWrapper(nm,O_RDONLY,0);
int fd=openWrapper(nm,O_RDONLY);
if(int r=::read(fd,buf+prev,sz);r<0)
raise("receiveFile",preserveError(fd));
return fd;
Expand Down
2 changes: 1 addition & 1 deletion src/tiers/cmwA.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ struct cmwRequest{
*mdlFile='/';
char last[60];
::snprintf(last,sizeof last,".%s.last",++mdlFile);
fl=FileWrapper{last,O_RDWR|O_CREAT,S_IRUSR|S_IWUSR|S_IRGRP};
fl=FileWrapper{last,O_RDWR|O_CREAT,0640};
switch(::pread(fl(),&prevTime,sizeof prevTime,0)){
case 0:prevTime=0;break;
case -1:raise("pread",errno);
Expand Down

0 comments on commit 412b09b

Please sign in to comment.