Skip to contentSkip to conversation

initscripts: hide the error in case swapoff does not exist

PATCH In review Ming Liu 2 participants 3 messages May 26, 2016

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/1 initscripts: hide the error in case swapoff does not exist

From: Ming Liu <[email protected]>

To avoid reporting errors when swapoff does not exist.

---
 meta/recipes-core/initscripts/initscripts-1.0/umountfs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/umountfs +1 -1
index 61324c6..d067234 100755
@@ -12,7 +12,7 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
 echo "Deactivating swap..."
-swapoff -a
+swapoff -a 2> /dev/null
 
 # We leave /proc mounted.
 echo "Unmounting local filesystems..."
Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 lines · Ming Liu

From: Ming Liu <[email protected]>

To avoid reporting errors when swapoff does not exist.

This will suppress *real* errors as well. Better to just check if swapoff exists and then run it if it does, if that's a concern.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
author
#2 lore raw
Quoted 7 lines · Christopher Larson

On Thu, May 26, 2016 at 12:44 PM, Ming Liu <[email protected] <mailto:[email protected]>> wrote:

From: Ming Liu <[email protected] <mailto:[email protected]>>

Quoted 7 lines

To avoid reporting errors when swapoff does not exist.

<mailto:[email protected]>>

This will suppress *real* errors as well. Better to just check if swapoff exists and then run it if it does, if that's a concern.

Yes, checking if it exists makes more sense. And swapon is being used with 2> /dev/null as well in some places, better to change them also. I will send a V1 soon.

//Ming Liu

Quoted 6 lines
Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics