Fix bug on checking error conditions when calling dlsym()
authorSoo-Hyun Choi <sh9.choi@samsung.com>
Wed, 25 Sep 2013 16:20:31 +0000 (01:20 +0900)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Sun, 29 Sep 2013 08:41:18 +0000 (08:41 +0000)
commitde578322b45cb0891ebfaec77d6be229e4f771b5
tree6543c9dd2442a7898fe220d3b77729438556a578
parentb218fffcf54bfb30b0c41da2dfeac23e67b5adcd
Fix bug on checking error conditions when calling dlsym()

[Issue#]   N/A
[Problem]  A bug on checking error conditions when calling dlsym()
[Cause]    Missed to call dlerror() to clear any old error conditions.
[Solution] Added dlerror() before calling dlsym().
           Also, separated error conditions:
           one for dlsym related error and another for DRM API related error.

[Remarks] DLOPEN(3)
    The function dlsym() takes a "handle" of a dynamic library returned by
    dlopen() and the null-terminated symbol name, returning the address where
    that  symbol is loaded into memory.  If the symbol is not found, in the
    specified library or any of the libraries that were automatically loaded
    by dlopen() when that library was loaded, dlsym() returns NULL.  (The
    search performed by dlsym() is breadth first through the  dependency  tree
    of  these libraries.)  Since the value of the symbol could actually be
    NULL (so that a NULL return from dlsym() need not indicate an error), the
    correct way to test for an error is to call dlerror() to clear any old
    error conditions, then call dlsym(), and then call dlerror() again,  sav‐
    ing its return value into a variable, and check whether this saved value
    is not NULL.

Change-Id: Idee1834fbdcfee184d07f757c871994e9832d7d4
src/jobs/widget_install/widget_unzip.cpp