[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 |
| Comment by Gerrit Updater [ 09/Aug/15 ] |
|
Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/15783/ |
| Comment by Peter Jones [ 10/Aug/15 ] |
|
Landed for 2.8 |