Skip to content

Commit 76b5b4c

Browse files
committed
[roc-cleanup] Ignore system() return value
1 parent 78e487b commit 76b5b4c

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/CommandLineUtilities/ProgramCleanup.cxx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <boost/algorithm/string/predicate.hpp>
1818
#include <boost/filesystem.hpp>
1919
#include <iostream>
20-
#include "Common/System.h"
2120
#include "ReadoutCard/ChannelFactory.h"
2221
#include "CommandLineUtilities/Common.h"
2322
#include "CommandLineUtilities/Options.h"
@@ -74,28 +73,34 @@ class ProgramCleanup : public Program
7473
Pda::freePdaDmaBuffers();
7574

7675
std::cout << "Removing CRORC FIFO shared memory files" << std::endl;
77-
system("rm /dev/shm/AliceO2_RoC_*");
76+
sysIgnored("rm /dev/shm/AliceO2_RoC_*");
7877
std::cout << "Removing readout 2MB hugepage mappings" << std::endl;
79-
system("rm /var/lib/hugetlbfs/global/pagesize-2MB/readout*");
78+
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-2MB/readout*");
8079
std::cout << "Removing readout 1GB hugepage mappings" << std::endl;
81-
system("rm /var/lib/hugetlbfs/global/pagesize-1GB/readout*");
80+
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-1GB/readout*");
8281
std::cout << "Removing roc-bench-dma 2MB hugepage mappings" << std::endl;
83-
system("rm /var/lib/hugetlbfs/global/pagesize-2MB/roc-bench-dma*");
82+
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-2MB/roc-bench-dma*");
8483
std::cout << "Removing roc-bench-dma 1GB hugepage mappings" << std::endl;
85-
system("rm /var/lib/hugetlbfs/global/pagesize-1GB/roc-bench-dma*");
84+
sysIgnored("rm /var/lib/hugetlbfs/global/pagesize-1GB/roc-bench-dma*");
8685

8786
if (!mOptions.light) {
8887
std::cout << "Removing uio_pci_dma" << std::endl;
89-
system("modprobe -r uio_pci_dma");
88+
sysIgnored("modprobe -r uio_pci_dma");
9089
std::cout << "Reinserting uio_pci_dma" << std::endl;
91-
system("modprobe uio_pci_dma");
90+
sysIgnored("modprobe uio_pci_dma");
9291
}
9392
}
9493

9594
private:
9695
struct OptionsStruct {
9796
bool light = false;
9897
} mOptions;
98+
99+
// Ignore system()'s return value
100+
void sysIgnored(const char* command)
101+
{
102+
static_cast<void>(system(command));
103+
}
99104
};
100105

101106
int main(int argc, char** argv)

0 commit comments

Comments
 (0)