ports/archivers/par2cmdline/patches/patch-src_par2cmdline_cpp

57 lines
1.6 KiB
Text
Raw Normal View History

2023-08-16 22:26:55 +00:00
pledge:
'par2 create' - stdio rpath wpath cpath
creates and writes par files
'par2 repair' - stdio rpath wpath cpath
renames and deletes partial/damaged files, writes repaired files
'par2 verify' - stdio rpath cpath
may delete par files, only if -p option was given, otherwise
cpath is not required
Index: src/par2cmdline.cpp
--- src/par2cmdline.cpp.orig
+++ src/par2cmdline.cpp
@@ -34,6 +34,14 @@ int main(int argc, char *argv[])
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_ALLOC_MEM_DF | /*_CRTDBG_CHECK_CRT_DF | */_CRTDBG_DELAY_FREE_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
#endif
+#ifdef HAVE_PLEDGE
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ {
+ cerr << "pledge failed" << endl;
+ return eLogicError;
+ }
+#endif
+
// Parse the command line
CommandLine *commandline = new CommandLine;
@@ -55,6 +63,26 @@ int main(int argc, char *argv[])
break;
case CommandLine::opVerify:
{
+#ifdef HAVE_PLEDGE
+ if (!commandline->GetPurgeFiles())
+ {
+ if (pledge("stdio rpath", NULL) == -1)
+ {
+ cerr << "pledge failed" << endl;
+ result = eLogicError;
+ break;
+ }
+ }
+ else
+ {
+ if (pledge("stdio rpath cpath", NULL) == -1)
+ {
+ cerr << "pledge failed" << endl;
+ result = eLogicError;
+ break;
+ }
+ }
+#endif
// Verify damaged files
switch (commandline->GetVersion())
{