Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
296ab7b7
Commit
296ab7b7
authored
2 years ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
Check free disk space when batch-uploading to the blind upload directory
This fixes issue
#516
parent
437c7319
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ctrl/text.dat
+4
-4
4 additions, 4 deletions
ctrl/text.dat
src/sbbs3/bat_xfer.cpp
+2
-0
2 additions, 0 deletions
src/sbbs3/bat_xfer.cpp
src/sbbs3/sbbs.h
+1
-0
1 addition, 0 deletions
src/sbbs3/sbbs.h
src/sbbs3/upload.cpp
+28
-18
28 additions, 18 deletions
src/sbbs3/upload.cpp
with
35 additions
and
22 deletions
ctrl/text.dat
+
4
−
4
View file @
296ab7b7
...
@@ -240,9 +240,9 @@
...
@@ -240,9 +240,9 @@
"\1r\1hFilenames, specs, or flags [None]: \1m\1h\1~" 197 BatchDlFlags
"\1r\1hFilenames, specs, or flags [None]: \1m\1h\1~" 197 BatchDlFlags
"\r\n\7\1r\1h\1iBatch download queue is full.\1n\r\n" 198 BatchDlQueueIsFull
"\r\n\7\1r\1h\1iBatch download queue is full.\1n\r\n" 198 BatchDlQueueIsFull
"\1_\1?\1y\1hFilespec [\1wAll Files\1y]: \1n" 199 FileSpecStarDotStar
"\1_\1?\1y\1hFilespec [\1wAll Files\1y]: \1n" 199 FileSpecStarDotStar
"\
r\n\r\n
\1r\1h\1iNot enough free disk space.\1n\r\n"\ 200 LowDiskSpace
"\
1?
\1r\1h\1iNot enough free disk space.\1n\r\n"\
200 LowDiskSpace
"\r\n\1hThe sysop has been notified.\1n\r\n"
"\r\n\1hThe sysop has been notified.\1n\r\n"
"\r\n%s
kilo
bytes free\r\n\r\n" 201 DiskNBytesFree
"\r\n%s bytes free\r\n\r\n"
201 DiskNBytesFree
"\1_\1y\1hFilename: \1n" 202 Filename
"\1_\1y\1hFilename: \1n" 202 Filename
"\1/\1r\1hBad filename: '%s'\r\n" 203 BadFilename
"\1/\1r\1hBad filename: '%s'\r\n" 203 BadFilename
"Upload '%s' to Sysop directory" 204 UploadToSysopDirQ
"Upload '%s' to Sysop directory" 204 UploadToSysopDirQ
...
@@ -705,7 +705,7 @@
...
@@ -705,7 +705,7 @@
"upcoming event on \1w%s\r\n\r\n"
"upcoming event on \1w%s\r\n\r\n"
"\1n\r\nTimed Event - Node: %d Time: %02d:%02d "\ 568 EventInfo
"\1n\r\nTimed Event - Node: %d Time: %02d:%02d "\ 568 EventInfo
"Last Ran: %s\r\n"
"Last Ran: %s\r\n"
"\1_\1r\1h\1i\
r\n\r\n
Connection will be dropped in %d "\ 569 UploadBeforeEvent
"\1_\1r\1h\1i\
1?
Connection will be dropped in %d "\ 569 UploadBeforeEvent
"minutes due to upcoming event.\1n"
"minutes due to upcoming event.\1n"
"\1_\1y\1h\r\nQWK: \1n" 570 QWKPrompt
"\1_\1y\1h\r\nQWK: \1n" 570 QWKPrompt
"\r\nCtrl-A codes: ~Expand to ANSI, ~Leave in, or "\ 571 QWKCtrlACodes
"\r\nCtrl-A codes: ~Expand to ANSI, ~Leave in, or "\ 571 QWKCtrlACodes
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/bat_xfer.cpp
+
2
−
0
View file @
296ab7b7
...
@@ -182,6 +182,8 @@ void sbbs_t::batchmenu()
...
@@ -182,6 +182,8 @@ void sbbs_t::batchmenu()
bputs
(
text
[
UploadQueueIsEmpty
]);
bputs
(
text
[
UploadQueueIsEmpty
]);
break
;
break
;
}
}
if
(
cfg
.
upload_dir
!=
INVALID_DIR
&&
!
okay_to_upload
(
cfg
.
upload_dir
))
break
;
xfer_prot_menu
(
XFER_BATCH_UPLOAD
);
xfer_prot_menu
(
XFER_BATCH_UPLOAD
);
if
(
!
create_batchup_lst
())
if
(
!
create_batchup_lst
())
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/sbbs.h
+
1
−
0
View file @
296ab7b7
...
@@ -1040,6 +1040,7 @@ public:
...
@@ -1040,6 +1040,7 @@ public:
/* upload.cpp */
/* upload.cpp */
bool
uploadfile
(
file_t
*
f
);
bool
uploadfile
(
file_t
*
f
);
bool
okay_to_upload
(
uint
dirnum
);
bool
upload
(
uint
dirnum
);
bool
upload
(
uint
dirnum
);
char
upload_lastdesc
[
LEN_FDESC
+
1
];
char
upload_lastdesc
[
LEN_FDESC
+
1
];
bool
bulkupload
(
uint
dirnum
);
bool
bulkupload
(
uint
dirnum
);
...
...
This diff is collapsed.
Click to expand it.
src/sbbs3/upload.cpp
+
28
−
18
View file @
296ab7b7
...
@@ -199,6 +199,32 @@ bool sbbs_t::uploadfile(file_t* f)
...
@@ -199,6 +199,32 @@ bool sbbs_t::uploadfile(file_t* f)
return
true
;
return
true
;
}
}
bool
sbbs_t
::
okay_to_upload
(
uint
dirnum
)
{
char
str
[
MAX_PATH
+
1
];
char
path
[
MAX_PATH
+
1
];
SAFECOPY
(
path
,
cfg
.
dir
[
dirnum
]
->
path
);
if
(
!
isdir
(
path
))
{
bprintf
(
text
[
DirectoryDoesNotExist
],
path
);
lprintf
(
LOG_ERR
,
"File directory does not exist: %s"
,
path
);
return
(
false
);
}
/* get free disk space */
ulong
space
=
getfreediskspace
(
path
,
1024
);
byte_count_to_str
(
space
*
1024
,
str
,
sizeof
(
str
));
if
(
space
<
(
ulong
)(
cfg
.
min_dspace
/
1024
))
{
bputs
(
text
[
LowDiskSpace
]);
lprintf
(
LOG_ERR
,
"Diskspace is low: %s (%s bytes)"
,
path
,
str
);
if
(
!
dir_op
(
dirnum
))
return
(
false
);
}
bprintf
(
text
[
DiskNBytesFree
],
str
);
return
true
;
}
/****************************************************************************/
/****************************************************************************/
/* Uploads files */
/* Uploads files */
/****************************************************************************/
/****************************************************************************/
...
@@ -211,7 +237,6 @@ bool sbbs_t::upload(uint dirnum)
...
@@ -211,7 +237,6 @@ bool sbbs_t::upload(uint dirnum)
char
tmp
[
512
];
char
tmp
[
512
];
time_t
start
,
end
;
time_t
start
,
end
;
uint
i
,
j
,
k
;
uint
i
,
j
,
k
;
ulong
space
;
file_t
f
=
{{}};
file_t
f
=
{{}};
str_list_t
dest_user_list
=
NULL
;
str_list_t
dest_user_list
=
NULL
;
...
@@ -239,23 +264,8 @@ bool sbbs_t::upload(uint dirnum)
...
@@ -239,23 +264,8 @@ bool sbbs_t::upload(uint dirnum)
if
(
sys_status
&
SS_EVENT
&&
online
==
ON_REMOTE
&&
!
dir_op
(
dirnum
))
if
(
sys_status
&
SS_EVENT
&&
online
==
ON_REMOTE
&&
!
dir_op
(
dirnum
))
bprintf
(
text
[
UploadBeforeEvent
],
timeleft
/
60
);
bprintf
(
text
[
UploadBeforeEvent
],
timeleft
/
60
);
SAFECOPY
(
path
,
cfg
.
dir
[
dirnum
]
->
path
);
if
(
!
okay_to_upload
(
dirnum
))
return
false
;
if
(
!
isdir
(
path
))
{
bprintf
(
text
[
DirectoryDoesNotExist
],
path
);
lprintf
(
LOG_ERR
,
"File directory does not exist: %s"
,
path
);
return
(
false
);
}
/* get free disk space */
space
=
getfreediskspace
(
path
,
1024
);
if
(
space
<
(
ulong
)(
cfg
.
min_dspace
/
1024
))
{
bputs
(
text
[
LowDiskSpace
]);
lprintf
(
LOG_ERR
,
"Diskspace is low: %s (%lu KB)"
,
path
,
space
);
if
(
!
dir_op
(
dirnum
))
return
(
false
);
}
bprintf
(
text
[
DiskNBytesFree
],
ultoac
(
space
,
tmp
));
f
.
dir
=
curdirnum
=
dirnum
;
f
.
dir
=
curdirnum
=
dirnum
;
bputs
(
text
[
Filename
]);
bputs
(
text
[
Filename
]);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment