[LU-6090] DLC: minor cleanup of dlc API code Created: 07/Jan/15  Updated: 10/Aug/15  Resolved: 10/Aug/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.8.0

Type: Bug Priority: Minor
Reporter: Amir Shehata (Inactive) Assignee: Amir Shehata (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 16952

 Description   

1. save errno before calling snprintf since that could overwrite errno.



 Comments   
Comment by Doug Oucharek (Inactive) [ 08/Jan/15 ]

Where is the code in question? Is this the user space library?

Comment by Amir Shehata (Inactive) [ 09/Jan/15 ]

yes in liblnetconfig.c. Reason it's minor is because it will only get reset if there is a problem with the output, which is not likely, but it's good to clean it up, so that we save the errno before calling snprintf, as recommended in: http://linux.die.net/man/3/errno

Comment by Isaac Huang (Inactive) [ 09/Jan/15 ]

To be paranoid, according to the man page: "a function that succeeds is allowed to change errno". I actually saw it happen once with other library functions. It's always a good idea to save errno if it's needed across function calls.

Comment by Gerrit Updater [ 28/Jul/15 ]

Amir Shehata (amir.shehata@intel.com) uploaded a new patch: http://review.whamcloud.com/15783
Subject: LU-6090 lnet: save errno between function calls
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 5c67a6e1cffbadaa2746941084aa30db66feac4d

Comment by Gerrit Updater [ 09/Aug/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/15783/
Subject: LU-6090 lnet: save errno between function calls
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: f6c886e36d0729b0791e393386e0b4b9c571ce30

Comment by Peter Jones [ 10/Aug/15 ]

Landed for 2.8

Generated at Sat Feb 10 01:57:08 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.