[debian-edu-commits] debian-edu/ 44/183: don't forget to close extra file descriptor, once we're done with it

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:32 UTC 2014


This is an automated email from the git hooks/post-receive script.

ccscanf-guest pushed a commit to branch master
in repository desktop-profiles.

commit 0e73f9d733779fd5ddd838297b0eb411179d7d7b
Author: Bart Cornelis <cobaco at linux.be>
Date:   Mon Jan 24 18:12:28 2005 +0000

    don't forget to close extra file descriptor, once we're done with it
---
 20desktop-profiles_activateDesktopProfiles | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/20desktop-profiles_activateDesktopProfiles b/20desktop-profiles_activateDesktopProfiles
index 3b28571..bffa424 100644
--- a/20desktop-profiles_activateDesktopProfiles
+++ b/20desktop-profiles_activateDesktopProfiles
@@ -30,8 +30,8 @@ sort_profiles(){
   KDEDIRS='';XDG_CONFIG_DIRS='';XDG_DATA_DIRS='';CHOICESPATH='';GNUSTEP_PATHLIST='';UDEDIRS=''
  
   # get profiles that are have fulfilled requirements, and save result on file descriptor 3
-  # FIXME: can we avoid the tempfile here?
   PROFILES=`tempfile`;
+  exec 3<> $PROFILES;
   (# get profiles that are have fulfilled requirements
      cat $(list_listings) | grep -v -e "^[[:space:]]*#" -e "^[[:space:]]*$" | while read PROFILE; do
       if (test_profile_requirements "$PROFILE"); then
@@ -40,11 +40,10 @@ sort_profiles(){
     done;
    #and sort them by preference 
   ) | sort --reverse --general-numeric-sort --field-separator=";" --key 3 > $PROFILES;
-  exec 3<> $PROFILES;
   rm $PROFILES;
 
-  # read from file descriptor 3 
-  # (don't use pipe, because then variables being changed are in a subshell)
+  # read from file descriptor 3 (not using pipe, because then variables being
+  # changed are in a subshell, and thus unchanged outside the while loop)
   while read PROFILE <&3; do
   # sort per profile kind
     KIND=`echo "$PROFILE" | cut --fields 5 --delimiter ";"`;
@@ -64,6 +63,9 @@ sort_profiles(){
       echo "`echo "$PROFILE" | cut --fields 2 --delimiter ";"` " >> $GCONF_FILE;
     fi;	
   done;
+
+  # close filedescriptor
+  exec 3>&- ; 
 }
 
 ##########################################################

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/desktop-profiles.git



More information about the debian-edu-commits mailing list